Last active
August 4, 2020 20:22
-
-
Save laurent-dinh/c72459b77fe1a668a91c9d889dcf94e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| for FILENAME_WEBP in `ls $1 | grep "webp"` | |
| do | |
| DELAY=${DELAY:-10} | |
| LOOP=${LOOP:-0} | |
| echo $FILENAME_WEBP | |
| FILENAME_WEBP_PREFIX=$(echo $FILENAME_WEBP | sed 's/\(.*\)\.webp/\1/') | |
| echo $FILENAME_WEBP_PREFIX | |
| n=`webpinfo -summary $FILENAME_WEBP | grep frames | sed -e 's/.* \([0-9]*\)$/\1/'` | |
| dur=`webpinfo -summary $FILENAME_WEBP | grep Duration | head -1 | sed -e 's/.* \([0-9]*\)$/\1/'` | |
| if (( $dur > 0 )); then | |
| DELAY = dur | |
| fi | |
| for i in $(seq -f "%05g" 1 $n) | |
| do | |
| webpmux -get frame $i $FILENAME_WEBP -o $FILENAME_WEBP_PREFIX.$i.webp | |
| dwebp $FILENAME_WEBP_PREFIX.$i.webp -o $FILENAME_WEBP_PREFIX.$i.png | |
| done | |
| convert $FILENAME_WEBP_PREFIX.*.png -delay $DELAY -loop $LOOP $FILENAME_WEBP_PREFIX.gif | |
| rm $FILENAME_WEBP_PREFIX.[0-9]*.png $FILENAME_WEBP_PREFIX.[0-9]*.webp | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment