You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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!
The text was updated successfully, but these errors were encountered:
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
methodGIFPlugin
there is this part of the code: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
fromsorl.thumbnail.engines.pil_engine.py
there is this piece of code: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 apalette
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!
The text was updated successfully, but these errors were encountered: