Last active
March 7, 2020 17:21
-
-
Save paulll/5c59fbd17da2381557d2 to your computer and use it in GitHub Desktop.
Convert webp animation to gif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# example usage: | |
# $ webp2gif input.webp output.gif | |
dir0=`pwd` | |
dir=`mktemp -d` | |
cd $dir | |
for i in $(seq -f "$04g" 0 1000); do; webpmux -get frame $i $dir0/$1 -o "$i.webp"; done; | |
mkdir png | |
for i in {0..1000}; do; dwebp "$i.webp" -o "png/$i.png"; done; | |
cd png | |
mv 0.png 1001.png | |
for i in {1..9}; do; mv "$i.png" "0$i.png"; done; | |
convert -delay 10 -loop 0 *.png animation.gif | |
cd $dir0 | |
cp "$dir/png/animation.gif" $2 | |
rm -rf $dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
like a god, thanks