diff --git a/PIL/ImageSequence.py b/PIL/ImageSequence.py index 76bc2d826..1fc6e5de1 100644 --- a/PIL/ImageSequence.py +++ b/PIL/ImageSequence.py @@ -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 diff --git a/Tests/test_imagesequence.py b/Tests/test_imagesequence.py index 3e30b3ca3..1cd98ddf1 100644 --- a/Tests/test_imagesequence.py +++ b/Tests/test_imagesequence.py @@ -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()