1
0
Fork 0
forked from josch/img2pdf

allow palette PNG images with ICC profile (closes: #107)

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-06-14 18:34:46 +02:00
parent b4c8aa1a5f
commit 3d7e0e6812
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -823,7 +823,9 @@ class pdfdoc(object):
elif color == Colorspace.CMYK or color == Colorspace["CMYK;I"]: elif color == Colorspace.CMYK or color == Colorspace["CMYK;I"]:
iccpdict[PdfName.N] = 4 iccpdict[PdfName.N] = 4
elif color == Colorspace.P: elif color == Colorspace.P:
raise Exception("Cannot have Palette images with ICC profile") # Only the png format can have an icc profile as well as a
# color palette. A png palette is always RGB.
iccpdict[PdfName.N] = 3
colorspace = [PdfName.ICCBased, iccpdict] colorspace = [PdfName.ICCBased, iccpdict]
# either embed the whole jpeg or deflate the bitmap representation # either embed the whole jpeg or deflate the bitmap representation