Skip to content

Commit

Permalink
Use _min_frame in ImageSequence.Iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jun 12, 2019
1 parent 72d5ee3 commit ea02e28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Tests/test_imagesequence.py
Expand Up @@ -32,6 +32,12 @@ def test_iterator(self):
self.assertRaises(IndexError, lambda: i[index+1])
self.assertRaises(StopIteration, next, i)

def test_iterator_min_frame(self):
im = Image.open('Tests/images/hopper.psd')
i = ImageSequence.Iterator(im)
for index in range(1, im.n_frames):
self.assertEqual(i[index], next(i))

def _test_multipage_tiff(self):
im = Image.open('Tests/images/multipage.tiff')
for index, frame in enumerate(ImageSequence.Iterator(im)):
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageSequence.py
Expand Up @@ -32,7 +32,7 @@ def __init__(self, im):
if not hasattr(im, "seek"):
raise AttributeError("im must have seek method")
self.im = im
self.position = 0
self.position = getattr(self.im, "_min_frame", 0)

def __getitem__(self, ix):
try:
Expand Down

0 comments on commit ea02e28

Please sign in to comment.