Do not clear tile if not updating the image when seeking

This commit is contained in:
Andrew Murray 2022-07-21 09:05:14 +10:00
parent 446446f579
commit 0844fb0ed3
3 changed files with 7 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

View File

@ -399,6 +399,11 @@ def test_no_change():
assert im.is_animated assert im.is_animated
assert_image_equal(im, expected) assert_image_equal(im, expected)
with Image.open("Tests/images/comment_after_only_frame.gif") as im:
expected = Image.new("P", (1, 1))
assert not im.is_animated
assert_image_equal(im, expected)
def test_eoferror(): def test_eoferror():
with Image.open(TEST_GIF) as im: with Image.open(TEST_GIF) as im:

View File

@ -185,8 +185,6 @@ class GifImageFile(ImageFile.ImageFile):
if not s or s == b";": if not s or s == b";":
raise EOFError raise EOFError
self.tile = []
palette = None palette = None
info = {} info = {}
@ -295,6 +293,8 @@ class GifImageFile(ImageFile.ImageFile):
if not update_image: if not update_image:
return return
self.tile = []
if self.dispose: if self.dispose:
self.im.paste(self.dispose, self.dispose_extent) self.im.paste(self.dispose, self.dispose_extent)