src/tests/__init__.py: handle PNG input images properly

main
parent b99fae1380
commit d931f02709
Signed by untrusted user: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -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…
Cancel
Save