Skip to content

Improvements to TIFF is_animated and n_frames#3714

Merged
hugovk merged 3 commits into
python-pillow:masterfrom
radarhere:tiff_frames
Mar 30, 2019
Merged

Improvements to TIFF is_animated and n_frames#3714
hugovk merged 3 commits into
python-pillow:masterfrom
radarhere:tiff_frames

Conversation

@radarhere

Copy link
Copy Markdown
Member
  • Because __next reveals if there is a next frame or not, _is_animated can be determined on the initial seek. That also means that the tests can be simplified slightly, because is_animated no longer interacts with _n_frames. You might think that this means that the is_animated decorator can be replaced with just a variable. However, MicImageFile inherits TiffImageFile, and is_animated can't be set directly in that circumstance.
  • Because __next reveals if there is a next frame or not, _n_frames can be populated automatically if seeking to the last frame.
  • The search in n_frames for the last frame can be made faster by starting from the last frame ever seeked, rather than just from the current position.

@hugovk
hugovk merged commit 05849ca into python-pillow:master Mar 30, 2019
@radarhere
radarhere deleted the tiff_frames branch March 30, 2019 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants