Convert 8-bit PNG & GIF alpha channels to /SMasks in PDF #106

Merged
josch merged 7 commits from tzahola/img2pdf:png-alpha-to-smask into main 2021-08-22 08:08:26 +00:00
Showing only changes of commit cfbb40b0f6 - Show all commits

View file

@ -858,6 +858,8 @@ class pdfdoc(object):
image[PdfName.ColorSpace] = colorspace image[PdfName.ColorSpace] = colorspace
image[PdfName.BitsPerComponent] = depth image[PdfName.BitsPerComponent] = depth
smask = None
if color == Colorspace["CMYK;I"]: if color == Colorspace["CMYK;I"]:
# Inverts all four channels # Inverts all four channels
image[PdfName.Decode] = [1, 0, 1, 0, 1, 0, 1, 0] image[PdfName.Decode] = [1, 0, 1, 0, 1, 0, 1, 0]