Skip to content

Commit 0844fb0

Browse files
committed
Do not clear tile if not updating the image when seeking
1 parent 446446f commit 0844fb0

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
54 Bytes
Loading

Tests/test_file_gif.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@ def test_no_change():
399399
assert im.is_animated
400400
assert_image_equal(im, expected)
401401

402+
with Image.open("Tests/images/comment_after_only_frame.gif") as im:
403+
expected = Image.new("P", (1, 1))
404+
assert not im.is_animated
405+
assert_image_equal(im, expected)
406+
402407

403408
def test_eoferror():
404409
with Image.open(TEST_GIF) as im:

src/PIL/GifImagePlugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ def _seek(self, frame, update_image=True):
185185
if not s or s == b";":
186186
raise EOFError
187187

188-
self.tile = []
189-
190188
palette = None
191189

192190
info = {}
@@ -295,6 +293,8 @@ def _seek(self, frame, update_image=True):
295293
if not update_image:
296294
return
297295

296+
self.tile = []
297+
298298
if self.dispose:
299299
self.im.paste(self.dispose, self.dispose_extent)
300300

0 commit comments

Comments
 (0)