mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge pull request #1686 from radarhere/seek
Allow ImageSequence to seek to zero
This commit is contained in:
commit
7d1df35089
|
@ -36,8 +36,7 @@ class Iterator(object):
|
|||
|
||||
def __getitem__(self, ix):
|
||||
try:
|
||||
if ix:
|
||||
self.im.seek(ix)
|
||||
self.im.seek(ix)
|
||||
return self.im
|
||||
except EOFError:
|
||||
raise IndexError # end of sequence
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user