Created
October 21, 2009 21:39
-
-
Save allaryin/215488 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
for DIR in $@; do | |
if [ ! -d $DIR ]; then | |
echo "$DIR is not a directory" | |
else | |
echo "Animating all PNG's from $DIR" | |
TMPDIR=`mktemp -d -p . .animate.XXXXXX` | |
echo "- tmp dir = $TMPDIR" | |
echo -n "- converting png's to gif ... " | |
for PNG in $DIR/*.png; do | |
DEST=$TMPDIR/`basename $PNG .png`.gif | |
convert -format gif $PNG $DEST | |
echo -n ". " | |
done | |
echo "done." | |
echo "- gifsicling ..." | |
gifsicle -O2 --delay=10 $TMPDIR/*.gif > `basename $DIR`.gif | |
echo "- unlinking tmp dir" | |
rm -rf $TMPDIR | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment