Skip to content

Instantly share code, notes, and snippets.

@jacroe
Last active December 27, 2015 20:09
Show Gist options
  • Save jacroe/7381850 to your computer and use it in GitHub Desktop.
Save jacroe/7381850 to your computer and use it in GitHub Desktop.
Mustachify a gif Based on an idea from @holman
if [ -z $1 ] || [ ! -f $1 ]
then
echo "Usage: ./cmds [location of gif]"
exit 1
else
output=/tmp/mustache
rm -rf $output
mkdir $output
echo "Extracting gif..."
convert "$1" -coalesce $output/frame_%03d.png
echo "...done."
mv $output/* ~/Dropbox/Public/mustache/
echo "Uploading to dropbox"
#sleep 60
read -p "Press [Enter] key to continue..."
echo "Starting to mustachify..."
for frame in ~/Dropbox/Public/mustache/*.png
do
name=$(basename "$frame")
url="http://dl.dropboxusercontent.com/u/170196/mustache/$name" # My public Dropbox URL
wget "http://mustachify.me/?src=$url" -O "$frame-stache" --tries=3
mv "$frame-stache" "$frame"
done
echo "... and done!"
mv ~/Dropbox/Public/mustache/* $output/
echo "Converting back to gif"
convert -delay 0 -loop 0 $output/frame_0*.png $output/stache.gif
mv $output/stache.gif .
eog stache.gif &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment