Create Animated GIF in Linux from Command Line

By | 2011/07/31

Imagemagick can easily make an animated gif from existing images with a simple command. I’ll show you how!

First, install imagemagick:

$ sudo apt-get install imagemagick

Next, gather all of your .jpg images together in a single folder or directory.

If needed, date/name files in a numbered or sequential order. The manor in which they appear listed in your directory is the order they will appear in the animated GIF!

Next, resize your .jpg images to a smaller size, such as 640×480 by using the following command:

$ mogrify -resize 640x480 *.jpg

And finally, issue the command below to create an animated gif of your jpg images.

Increase the delay time for a longer transition between images. Tack loop 0 will loop your GIF indefinitely. Tack loop 3 would loop three times, for example.

$ convert -delay 20 -loop 0 *.jpg myimage.gif