handle monochrome png properly

This commit is contained in:
Johannes 'josch' Schauer 2018-07-18 00:03:31 +02:00
parent eaf9de23c9
commit ac9ba1d0f6
Signed by: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 6 additions and 2 deletions

View file

@ -422,7 +422,9 @@ class pdfdoc(object):
if imgformat is ImageFormat.CCITTGroup4: if imgformat is ImageFormat.CCITTGroup4:
image[PdfName.BitsPerComponent] = 1 image[PdfName.BitsPerComponent] = 1
else: else:
if color == Colorspace.P: if color == Colorspace['1']:
image[PdfName.BitsPerComponent] = 1
elif color == Colorspace.P:
if len(palette) <= 2**1: if len(palette) <= 2**1:
image[PdfName.BitsPerComponent] = 1 image[PdfName.BitsPerComponent] = 1
elif len(palette) <= 2**4: elif len(palette) <= 2**4:
@ -451,7 +453,9 @@ class pdfdoc(object):
else: else:
decodeparms[PdfName.Colors] = 3 decodeparms[PdfName.Colors] = 3
decodeparms[PdfName.Columns] = imgwidthpx decodeparms[PdfName.Columns] = imgwidthpx
if color == Colorspace.P: if color == Colorspace['1']:
decodeparms[PdfName.BitsPerComponent] = 1
elif color == Colorspace.P:
if len(palette) <= 2**1: if len(palette) <= 2**1:
decodeparms[PdfName.BitsPerComponent] = 1 decodeparms[PdfName.BitsPerComponent] = 1
elif len(palette) <= 2**4: elif len(palette) <= 2**4:

Binary file not shown.