mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 13:46:57 +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):
|
def __getitem__(self, ix):
|
||||||
try:
|
try:
|
||||||
if ix:
|
self.im.seek(ix)
|
||||||
self.im.seek(ix)
|
|
||||||
return self.im
|
return self.im
|
||||||
except EOFError:
|
except EOFError:
|
||||||
raise IndexError # end of sequence
|
raise IndexError # end of sequence
|
||||||
|
|
|
@ -44,6 +44,17 @@ class TestImageSequence(PillowTestCase):
|
||||||
self._test_multipage_tiff()
|
self._test_multipage_tiff()
|
||||||
TiffImagePlugin.READ_LIBTIFF = False
|
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__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user