Creating GIF’s, Version 2: ImageMagick only

To the west of the 5 skeleton warrior room, a chamber full of bats appeared, and the doorway slammed shut behind me. I had a key, I could have ignored them, but I wanted to know what would reveal itself if they were all slain. It cost me dear health, but the chamber door opened.

To the west of the 5 skeleton warrior room, a chamber full of bats appeared, and the doorway slammed shut behind me. I had a key, I could have ignored them, but I wanted to know what would reveal itself if they were all slain. It cost me dear health, but the chamber door opened.

I was using gifBrewery because I knew how to resize a gif with it quickly. When I’m not cropping a to an artistic subset of the image, doing the whole process with the handful of lines of ImageMagick needs goes much more quickly.

mogrify *.png -gravity South -crop 1200×860+0+0 +repage *.png
convert -delay 50 *.png -colors 256 -loop 0 toT5_50.gif
convert toT5_50.gif -resize 310×215 tot5_50_tumb.gif
#Also could have used percentage resize:
#convert toT5_50.gif -resize 25% -colors 256 toT5_50_tumb.gif

Notice the use of mogrify to do the batch process at the beginning… That was the tricky part.

References Used:

http://www.tjhsst.edu/~dhyatt/supercomp/n401a.html

gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '–good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600×600\> out-static*.png GIF:- | gifsicle –colors 128 –delay=5 –loop –optimize=3 –multifile – > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600×400 -pix_fmt rgb24 -r 10 -f gif – | gifsicle –optimize=3 –delay=3 > $1.gif
fi
else
echo "proper usage: gifify <input_movie.mov>. You DO need to include extension."
fi
}

view raw
.zshrc
hosted with ❤ by GitHub

brew install ffmpeg
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install x-quartz
open /usr/local/Cellar/x-quartz/2.7.4/XQuartz.pkg
# click through the stuff
brew install gifsicle
brew install imagemagick
# I had a weird problem with Convert/imagemagick where I had to do:
ln -s /usr/local/Cellar/libtool/2.4.2/lib/libltdl.7.dylib libltdl.7.dylib
# But hopefully you don't have to

view raw
Install.sh
hosted with ❤ by GitHub

# Take screencast using Quicktime. Export as high quality as possible.
gifify screencap.mov
gifify screencap.mov –good

view raw
usage.sh
hosted with ❤ by GitHub

http://stackoverflow.com/questions/18197253/imagemagick-convert-individual-frame-delay-in-gif
http://www.imagemagick.org/Usage/resize/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s