Saturday, December 4, 2010

Create an Animated Gif with ImageMagick

I needed to create an animated series of images to observe some change over time.
To do this I decided to use ImageMagick on my linux machine. I save all of the images in a folder named image1.png, image2.png, image3.png, ... .

Then I used the following command.

convert -verbose -delay 200 -loop 0 image*.png output.gif

This takes the files named image*.png in the order that they are listed and makes a GIF out of them with a 200 hundreths of a second delay between each frame. The -loop 0 flag makes it loop indefinitely. You can put 4 in there to loop 4 times etc.

This worked fine but the order was not correct when I got over 10 images so for now I renamed them to imageA.png and went from there.

That solved my immediate need for an animated image but I need to find a neater solution to sorting the filenames.

No comments:

Post a Comment