Skip to content

Commit

Permalink
[tui] Changed TUI animation frame caching criteria
Browse files Browse the repository at this point in the history
- Change: Caching of animated image frames in the TUI is now based on image file size instead of frame count.

NOTE: This change is temporary and will be reverted as soon as a Pillow version including the improvements in python-pillow/Pillow#6077 is released.
  • Loading branch information
AnonymouX47 committed Mar 10, 2022
1 parent ea6f74b commit daf463f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion term_img/tui/main.py
Expand Up @@ -90,7 +90,12 @@ def next_frame(*_) -> None:
del image._forced_anim_size_hash

frame_duration = FRAME_DURATION or image._image._frame_duration
image._animator = ImageIterator(image._image, -1, f"1.1{image._alpha}")._animator
image._animator = ImageIterator(
image._image,
-1,
f"1.1{image._alpha}",
os.stat(image._image._source).st_size <= 2097152,
)._animator

# `Image.render()` checks for this. It has to be set here since `ImageIterator`
# doesn't set it until the first `next()` is called.
Expand Down

0 comments on commit daf463f

Please sign in to comment.