Posted as a comment in this stackexchange question
https://unix.stackexchange.com/questions/419761/webp-animation-to-gif-animation-cli
Usage:
- Make sure python3 is installed.
- Install
Pillow
package
python3 -m pip install --upgrade Pillow
- Download this script and run it as
python_pillow_webp2gif.py {{animated_image}}.webp
- Use gif output produced by name
{{animated_image}}.gif
@nimatrueway Thanks for the great script!
@reviveMC74 Your handling of alpha is still a little buggy. It works good for me for a long time, until I meet a special image today. After conversion, the transparent background turn into green. I guess maybe R G B A are not the good order.
Here is my patch. Firstly you don't have to convert alpha for each frame. Just keep it and let Pillow handle it at last when combining them to gif.
Secondly, you have to add some arguments to make alpha work in final git.
If you don't care about background, you can even just do this.
You have to add an argument to make alpha work when creating gif.
Note the
disposal=2
. If you don't set it, the new frame will not swipe the old content of last frame and produce a messy view.Anyway, thanks for your work. It really resolves my demand in a really easy way!🥰
UPDATE:
This should be better. Copy first, then convert.
UPDATE 2:
Looks like alpha channel will lead to palette size problem when combining to final gif. But I have to figure this out in the future, as I have no much time for now.