diff --git a/Tests/images/iss634.apng b/Tests/images/iss634.apng new file mode 100644 index 000000000..89e025906 Binary files /dev/null and b/Tests/images/iss634.apng differ diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index ca7d3c039..b837732cf 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -335,6 +335,18 @@ class TestFilePng(PillowTestCase): im.load() self.assertRaises(RuntimeError, im.verify) + def test_apng_load_verify(self): + # Check open/load/verify exception (@PIL150) + TEST_APNG_FILE = "Tests/images/iss634.apng" + im = Image.open(TEST_APNG_FILE) + + # Assert that there is no unclosed file warning + self.assert_warning(None, im.verify) + + im = Image.open(TEST_APNG_FILE) + im.load() + self.assertRaises(RuntimeError, im.verify) + def test_verify_struct_error(self): # Check open/load/verify exception (#1755) diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py index f780f811a..9a5d28bec 100644 --- a/src/PIL/PngImagePlugin.py +++ b/src/PIL/PngImagePlugin.py @@ -868,6 +868,6 @@ def getchunks(im, **params): Image.register_open(PngImageFile.format, PngImageFile, _accept) Image.register_save(PngImageFile.format, _save) -Image.register_extension(PngImageFile.format, ".png") +Image.register_extensions(PngImageFile.format, [".png", ".apng"]) Image.register_mime(PngImageFile.format, "image/png")