Skip to content

Instantly share code, notes, and snippets.

@allaryin
Created October 21, 2009 21:39
Show Gist options
  • Save allaryin/215488 to your computer and use it in GitHub Desktop.
Save allaryin/215488 to your computer and use it in GitHub Desktop.
#!/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