mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-25 03:23:41 +03:00
Merge pull request #3716 from radarhere/gif_rewind
Fixed GIF bug when rewinding to a non-zero frame
This commit is contained in:
commit
31ac5a96d1
|
@ -230,6 +230,15 @@ class TestFileGif(PillowTestCase):
|
||||||
|
|
||||||
self.assertEqual(im.info, info)
|
self.assertEqual(im.info, info)
|
||||||
|
|
||||||
|
def test_seek_rewind(self):
|
||||||
|
im = Image.open("Tests/images/iss634.gif")
|
||||||
|
im.seek(2)
|
||||||
|
im.seek(1)
|
||||||
|
|
||||||
|
expected = Image.open("Tests/images/iss634.gif")
|
||||||
|
expected.seek(1)
|
||||||
|
self.assert_image_equal(im, expected)
|
||||||
|
|
||||||
def test_n_frames(self):
|
def test_n_frames(self):
|
||||||
for path, n_frames in [
|
for path, n_frames in [
|
||||||
[TEST_GIF, 1],
|
[TEST_GIF, 1],
|
||||||
|
|
|
@ -122,6 +122,8 @@ class GifImageFile(ImageFile.ImageFile):
|
||||||
if not self._seek_check(frame):
|
if not self._seek_check(frame):
|
||||||
return
|
return
|
||||||
if frame < self.__frame:
|
if frame < self.__frame:
|
||||||
|
if frame != 0:
|
||||||
|
self.im = None
|
||||||
self._seek(0)
|
self._seek(0)
|
||||||
|
|
||||||
last_frame = self.__frame
|
last_frame = self.__frame
|
||||||
|
|
Loading…
Reference in New Issue
Block a user