ImageMagick – Creating a GIF Animation from PNG Files

conversiongraphicsimagemagick

Is there a tool to create a gif animation from a set of png files?

I tried the convert command from the ImageMagick suite, but this doesn't always succeed. Also, I have several issues with this:

  1. I can't tell what the progress is.
  2. No matter what I try, the -delay flag doesn't change the frame rate of the gif animation.
  3. convert determines the frame order based upon the alphabetical order of the files names. This means that name500.png will be placed right after name50.png and not after name450.png I can fix this by adding 0's but this is annoying.

Best Answer

Newer versions of ffmpeg have no -sameq (see faq) but do have GIF support.

ffmpeg -i %03d.png output.gif

Where %03d is the frame ID in 3 digits.

You may also try to use ffmpeg to create a movie out of a sequence of images and then convert the movie to a GIF animation (again using ffmpeg).

# cf. http://pages.uoregon.edu/noeckel/MakeMovie.html

# first convert an image sequence to a movie
ffmpeg -sameq -i %03d.jpg output.mp4

# ... and then convert the movie to a GIF animation
ffmpeg -i output.mp4 -pix_fmt rgb24 -s qcif -loop_output 0 output.gif
Related Question