Skip to content

Instantly share code, notes, and snippets.

@paulll
Last active March 7, 2020 17:21
Show Gist options
  • Save paulll/5c59fbd17da2381557d2 to your computer and use it in GitHub Desktop.
Save paulll/5c59fbd17da2381557d2 to your computer and use it in GitHub Desktop.
Convert webp animation to gif
#!/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
@oboje
Copy link

oboje commented Mar 7, 2020

like a god, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment