Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

animated gifs - preserve animation, as PIL/Pillow supports it #627

Closed
benzkji opened this issue Feb 3, 2024 · 4 comments
Closed

animated gifs - preserve animation, as PIL/Pillow supports it #627

benzkji opened this issue Feb 3, 2024 · 4 comments

Comments

@benzkji
Copy link
Contributor

benzkji commented Feb 3, 2024

See original closed issue #184 - I created a new issue, for a fresh start and more visibility :-)

Pillow docs: https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#gif-saving

Doing a quick test on my computer:

from PIL import Image

with Image.open("image.gif") as img:
    img.save("image-animation-removed.gif")

with Image.open("image.gif") as img:
    img.save("image-animation-preserved.gif", save_all=True)

This does exactly what filenames suggest. It supports animated GIFs (and probably animated webp as well, but I didnt test for these).

How about a setting: EASY_THUMBNAILS_PRESERVE_ANIMATIONS, to enable/disable animation preservation globally, in easy thumbnails? Also, to be backwards compatible?

I would be motivated to provide a PR. Digging through changelog, I saw THUMBNAIL_IMAGE_SAVE_OPTIONS, it may even already be possible?

@benzkji
Copy link
Contributor Author

benzkji commented Feb 3, 2024

So, in theory this would work an be supported by Pillow. In real live, the original GifImagePlugin object very soon (when treated by easy thumbnail processors) becomes an PIL.Image object, and drops it's frames. I still think it should be possible to preserve GIF animations, but it would probably not be as easy as in the above snippet ;-)

@benzkji
Copy link
Contributor Author

benzkji commented Feb 3, 2024

Also #217

@benzkji
Copy link
Contributor Author

benzkji commented Feb 5, 2024

WIP PR: #628

@benzkji benzkji changed the title animated gifs - preserve animation, as PIL/Pillow supports it in 2023 animated gifs - preserve animation, as PIL/Pillow supports it Feb 5, 2024
@benzkji benzkji closed this as completed Sep 13, 2024
@benzkji
Copy link
Contributor Author

benzkji commented Sep 13, 2024

yay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant