Merge pull request #5386 from radarhere/previous_frame_loaded

Fixed ensuring that GIF previous frame was loaded
This commit is contained in:
Hugo van Kemenade 2021-04-15 10:47:44 +03:00 committed by GitHub
commit 0cc2943aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -341,6 +341,17 @@ def test_dispose_previous():
pass
def test_previous_frame_loaded():
with Image.open("Tests/images/dispose_none.gif") as img:
img.load()
img.seek(1)
img.load()
img.seek(2)
with Image.open("Tests/images/dispose_none.gif") as img_skipped:
img_skipped.seek(2)
assert_image_equal(img_skipped, img)
def test_save_dispose(tmp_path):
out = str(tmp_path / "temp.gif")
im_list = [

View File

@ -148,7 +148,7 @@ class GifImageFile(ImageFile.ImageFile):
self.disposal_method = 0
else:
# ensure that the previous frame was loaded
if not self.im:
if self.tile:
self.load()
if frame != self.__frame + 1: