Using ImageMagick to convert a series of images to animated GIF

By atchieu

I use this a lot for research. I have a series of images in a postscript type format (e.g. EPS or PDF) and then I want to turn the time series of data into an animation. For this i use ImageMagick because it is a really nice command line tool for Unix operating systems to do batch type operations. You can even pipe it to C code! (Make sure you have it installed because it is not usually distributed with a bare Linux OS)

To do a simple conversion of images to an animated GIF we invoke the following

>convert -verbose -delay 20 -loop 0 -density 200 *.pdf output.gif

and we get a nice GIF file. This takes the files named *.pdf in the order that they are listed and makes a GIF out of them with a 20 hundreths of a second delay between each frame. The -loop 0 flag makes it loop indefinitely. You can put 3 in there to loop 3 times etc. The -density 200 flag specifies a DPI of 200 for the image. This is only really used when converting postscript images.

Animation of flow over a cylinder (vorticity) made from MATLAB + ImageMagick.

Animation of flow over a cylinder (vorticity) made from MATLAB + ImageMagick.

Tags: , ,

Leave a Reply