src/img2pdf.py: also reject palette images with transparency

This commit is contained in:
Johannes 'josch' Schauer 2018-08-17 07:27:15 +02:00
parent ba5a9a1dfc
commit 53685934f9
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -684,7 +684,7 @@ def get_imgmetadata(imgdata, imgformat, default_dpi, colorspace, rawdata=None):
ndpi = (int(round(ndpi[0])), int(round(ndpi[1])))
ics = imgdata.mode
if ics in ["LA", "PA", "RGBA"]:
if ics in ["LA", "PA", "RGBA"] or "transparency" in imgdata.info:
logging.warning("Image contains transparency which cannot be retained "
"in PDF.")
logging.warning("img2pdf will not perform a lossy operation.")