forked from josch/img2pdf
handle monochrome png properly
This commit is contained in:
parent
eaf9de23c9
commit
ac9ba1d0f6
2 changed files with 6 additions and 2 deletions
|
@ -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.
Loading…
Reference in a new issue