Archive | August 2013

Animated GIF with ImageMagick

Installing ImageMagick on OS X

Like the ImageMagick docs, I recommend using MacPorts but here are the steps to install just the binary release.

  1. Start in your home dir
    cd $HOME
  2. Download the ImageMagick-x86_64-apple-darwin12.4.0.tar.gz binary release from
    curl -O ""
  3. Extract the files
    tar -xvf ImageMagick-x86_64-apple-darwin12.4.0.tar.gz
  4. Export paths (change the ImageMagick version number 6.8.6 to the version you have)
    export MAGICK_HOME="$HOME/ImageMagick-6.8.6"
    export PATH="$MAGICK_HOME/bin:$PATH"
    export LD_LIBRARY_PATH

Creating the Animated GIF

This assumes you have source frames that match *.png (change this as needed)

  1. The -layers OptimizeFrame argument will save the smallest bounding rectangle that has changed in each frame
    convert -layers OptimizeFrame -loop 0 *.png output.gif
  2. You can also try -layers OptimizeTransparency to possibly reduce file size by only saving the pixels that changed between each frame
    convert -layers OptimizeTransparency -loop 0 *.png output.gif
  3. The -delay argument can be used to specify the time between frames in 1/100ths of a second

Additional Resources