mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +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")
|
||||
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")
|
||||
self.assert_image_similar(im, expected, 0.23)
|
||||
|
||||
|
|
|
@ -533,14 +533,6 @@ class PngStream(ChunkStream):
|
|||
self.im_custom_mimetype = 'image/apng'
|
||||
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
|
||||
|
@ -682,6 +674,9 @@ class PngImageFile(ImageFile.ImageFile):
|
|||
break
|
||||
except EOFError:
|
||||
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.png.close()
|
||||
self.png = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user