mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
Allow for unknown PNG chunks after image data
This commit is contained in:
parent
7bf5246b93
commit
4e0a73b4fa
|
@ -596,6 +596,7 @@ class TestFilePng(PillowTestCase):
|
||||||
im = Image.open("Tests/images/iss634.apng")
|
im = Image.open("Tests/images/iss634.apng")
|
||||||
self.assertEqual(im.get_format_mimetype(), 'image/apng')
|
self.assertEqual(im.get_format_mimetype(), 'image/apng')
|
||||||
|
|
||||||
|
# This also tests reading unknown PNG chunks (fcTL and fdAT) in load_end
|
||||||
expected = Image.open("Tests/images/iss634.webp")
|
expected = Image.open("Tests/images/iss634.webp")
|
||||||
self.assert_image_similar(im, expected, 0.23)
|
self.assert_image_similar(im, expected, 0.23)
|
||||||
|
|
||||||
|
|
|
@ -533,14 +533,6 @@ class PngStream(ChunkStream):
|
||||||
self.im_custom_mimetype = 'image/apng'
|
self.im_custom_mimetype = 'image/apng'
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def chunk_fcTL(self, pos, length):
|
|
||||||
s = ImageFile._safe_read(self.fp, length)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def chunk_fdAT(self, pos, length):
|
|
||||||
s = ImageFile._safe_read(self.fp, length)
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# PNG reader
|
# PNG reader
|
||||||
|
@ -682,6 +674,9 @@ class PngImageFile(ImageFile.ImageFile):
|
||||||
break
|
break
|
||||||
except EOFError:
|
except EOFError:
|
||||||
ImageFile._safe_read(self.fp, length)
|
ImageFile._safe_read(self.fp, length)
|
||||||
|
except AttributeError:
|
||||||
|
logger.debug("%r %s %s (unknown)", cid, pos, length)
|
||||||
|
ImageFile._safe_read(self.fp, length)
|
||||||
self._text = self.png.im_text
|
self._text = self.png.im_text
|
||||||
self.png.close()
|
self.png.close()
|
||||||
self.png = None
|
self.png = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user