mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Allowed ImageSequence to seek to zero
This commit is contained in:
parent
3d6e137ff2
commit
2b0c037d5f
|
@ -35,8 +35,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
|
||||
|
|
|
@ -44,6 +44,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