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 don't work #659

Closed
jbagot opened this issue Dec 7, 2020 · 1 comment
Closed

Animated GIFs don't work #659

jbagot opened this issue Dec 7, 2020 · 1 comment

Comments

@jbagot
Copy link

jbagot commented Dec 7, 2020

Hi,
I've been digging in the library and the PIL library as well and I found some things that doesn't allow to do a thumbnail of an animated GIF.

I'm trying to create a thumbnail of an animated GIF with PIL engine, debugging I saw how PIL knows that is a GIF and is using the GIFPlugin, that's good. But in the save method GIFPlugin there is this part of the code:

if not save_all or not _write_multiple_frames(im, fp, palette):
        _write_single_frame(im, fp, palette)

It's quite self-explanatory and of course is always entering inside the if and writting only a single frame, that's the main reason why is not working.
Then, there are 2 things here, first is the save_all that is impossible to be true using sorl_thumbnail library.

In the method _get_raw_data from sorl.thumbnail.engines.pil_engine.py there is this piece of code:

params = {
    'format': format_,
    'quality': quality,
    'optimize': 1,
}
...
image.save(bf, **params)

And should be here where we specify the save_all, this params should contains 'save_all': True. That quite easy...

BUT, the second part: _write_multiple_frames(im, fp, palette) it's more tricky, there is a palette var that my image doesn't have. Here is where I need some help, I'm a little bit lost in this part, someone with more experience in image managing can explain me what's this palette and what should I change to be able to run this method sucessfully?

I'll do a PR if someone help me with that, thanks.

BTW, there is another way to do a thumbnail with animated GIF? Perhaps with another engine?

Thank you!

@claudep
Copy link
Contributor

claudep commented Oct 26, 2024

Duplicate of #687

@claudep claudep marked this as a duplicate of #687 Oct 26, 2024
@claudep claudep closed this as completed Oct 26, 2024
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

2 participants