Merge pull request #1686 from radarhere/seek

Allow ImageSequence to seek to zero
This commit is contained in:
wiredfool 2016-01-31 09:08:09 -08:00
commit 7d1df35089
2 changed files with 12 additions and 2 deletions

View File

@ -36,7 +36,6 @@ class Iterator(object):
def __getitem__(self, ix):
try:
if ix:
self.im.seek(ix)
return self.im
except EOFError:

View File

@ -52,6 +52,17 @@ class TestImageSequence(PillowTestCase):
self._test_multipage_tiff()
TiffImagePlugin.READ_LIBTIFF = False
def test_consecutive(self):
im = Image.open('Tests/images/multipage.tiff')
firstFrame = None
for frame in ImageSequence.Iterator(im):
if firstFrame == None:
firstFrame = frame.copy()
pass
for frame in ImageSequence.Iterator(im):
self.assert_image_equal(frame, firstFrame)
break
if __name__ == '__main__':
unittest.main()