mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Speed up n_frames by skipping past the last frame already seeked
This commit is contained in:
parent
be80b083e5
commit
0a877a527d
|
@ -998,6 +998,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
def n_frames(self):
|
def n_frames(self):
|
||||||
if self._n_frames is None:
|
if self._n_frames is None:
|
||||||
current = self.tell()
|
current = self.tell()
|
||||||
|
self._seek(len(self._frame_pos))
|
||||||
while self._n_frames is None:
|
while self._n_frames is None:
|
||||||
self._seek(self.tell() + 1)
|
self._seek(self.tell() + 1)
|
||||||
self.seek(current)
|
self.seek(current)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user