mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Ensure previous FLI frame is loaded before seeking to the next
This commit is contained in:
parent
080bfd3ee1
commit
2f7f945c84
BIN
Tests/images/a_fli.png
Normal file
BIN
Tests/images/a_fli.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -85,6 +85,13 @@ class TestFileFli(PillowTestCase):
|
|||
layer_number = im.tell()
|
||||
self.assertEqual(layer_number, 1)
|
||||
|
||||
def test_seek(self):
|
||||
im = Image.open(animated_test_file)
|
||||
im.seek(50)
|
||||
|
||||
expected = Image.open("Tests/images/a_fli.png")
|
||||
self.assert_image_equal(im, expected)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -131,6 +131,9 @@ class FliImageFile(ImageFile.ImageFile):
|
|||
self.__frame = -1
|
||||
self.__fp.seek(self.__rewind)
|
||||
self.__offset = 128
|
||||
else:
|
||||
# ensure that the previous frame was loaded
|
||||
self.load()
|
||||
|
||||
if frame != self.__frame + 1:
|
||||
raise ValueError("cannot seek to frame %d" % frame)
|
||||
|
|
Loading…
Reference in New Issue
Block a user