forked from josch/img2pdf
src/tests/__init__.py: handle PNG input images properly
This commit is contained in:
parent
b99fae1380
commit
d931f02709
1 changed files with 32 additions and 23 deletions
|
@ -589,6 +589,15 @@ def test_suite():
|
|||
# to the pixel data of the input image
|
||||
imgdata = zlib.decompress(
|
||||
convert_store(cur_page.Resources.XObject.Im0.stream))
|
||||
if imgprops.DecodeParms:
|
||||
if orig_img.format == 'PNG':
|
||||
pngidat, palette = img2pdf.parse_png(orig_imgdata)
|
||||
else:
|
||||
pngbuffer = BytesIO()
|
||||
orig_img.save(pngbuffer, format="png")
|
||||
pngidat, palette = img2pdf.parse_png(pngbuffer.getvalue())
|
||||
self.assertEqual(zlib.decompress(pngidat), imgdata)
|
||||
else:
|
||||
colorspace = imgprops.ColorSpace
|
||||
if colorspace == PdfName.DeviceGray:
|
||||
colorspace = 'L'
|
||||
|
|
Loading…
Reference in a new issue