Creating Animated GIFs from the Command Line in Mac OS X Using Convert

You can easily create animated GIFs from the command line in Mac OS X (or Linux) using ImageMagick. To figure out if ImageMagick is installed open the application Terminal from the Utilities folder in Applications, type ‘convert’ and hit ‘Enter’. If something like »Version: ImageMagick 6.6.9-3 2011-04-04 Q16« and lots of options appear, ImageMagick is installed and you can proceed. If not, you can install it using MacPorts (look for ‘Mac OS X Binary Release’). install it using homebrew or MacPorts.

An animated GIF works like a flip-book, i.e. you need source images that can be stringed together to an animated GIF. In order to work with the following command, name your source images ‘source1.jpg’, ‘source2.jpg’ and so on. After you created the source images, ‘cd’ in the Terminal to their folder. If you don’t know how to ‘cd’: Type ‘cd’ followed by a space and then drag the folder with the source images to the Terminal and hit ‘Enter’. Now copy, paste and execute this command in the Terminal:

convert -delay 35 -loop 0 source*.jpg animated.gif

Play around with the delay parameter in order to see how the animated GIF changes.

Using convert, I created animated GIFs like this:

via Creating an Animated GIF Image

Tagged with: animated gif, commandline, imagemagick
  • How about homebrew instead of MacPorts?

  • yeah, why not?! use whatever works for you. i’ve read somewhere that some people have problems with MacPorts. updated the post to include both…

  • Donny

    Hey thanks! Exactly what I needed.

  • Kevin


  • hmm… Installed HomeBrew and Imagemagick as instructed elsewhere. Built a folder in the home directory called GIFfolder and placed the 5 GIF files inside. Attempted to use the above command, modified from .jpg to .gif – and Terminal returned “image not found”. Changed images to .jpg and used the command – same result “image not found. Confirmed I was working in GIFfolder directory and that it contained the images, so now where do I look for my error?

  • did you cd to the folder GIFfolder? did you name the GIFs source1.gif, source2.gif and so on?

  • Wow this is weird – I just came across your blog post to make an animated git and you’ve linked to my blog post on installing imagemagick :). Thanks!

  • great conincidence 🙂

  • Pingback: Weekly Links - Viral AcademyViral Academy()

  • Pingback: How to make Gimp save frames for animation | Martin Kašpar's Portfolio()

  • AppBaan

    Thank you. I had an animated gif in about 2 minutes w/ your method — versus 20 minutes of mucking about unsuccessfully in PhotoShop.

  • Marcus

    Simple and works perfectly. I was trying to find something for OS X comparable to a little windows app I would use called UnFREEz by whitsoftdev, this is it.

  • 杨向颖