Creating a GIF animation from PNG files
Is there a tool to create a
gifanimation from a set of
I tried the
convertcommand from the ImageMagick suite, but this doesn't always succeed. Also, I have several issues with this:
- I can't tell what the progress is.
- No matter what I try, the
-delayflag doesn't change the frame rate of the gif animation.
convertdetermines the frame order based upon the alphabetical order of the files names. This means that
name500.pngwill be placed right after
name50.pngand not after
name450.pngI can fix this by adding 0's but this is annoying.
Regarding item 3., you can still use `convert` after sorting the files. Probably, something like this works `files=$(ls name*png | sort -n -tname -k1); convert $files animation.gif`
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
ffmpegto create a movie out of a sequence of images and then convert the movie to a GIF animation (again using
# 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
The `sameq` option is not available anymore. Further, for me, this overwrites the original image files and does not produce a valid movie file.
What's the point of leaving the `-sameq` code there? Why would you even want to use a lossy video format (`output.mp4`) as a temporary? And if so, why "same quality" as the input, instead of very high bitrate? Artifacting from that is just going to make things worse for the GIF encoder. If you did need to use a video as a temporary, you'd want to use something lossless like huffyuv. Or MJPEG with no transcoding, just remux the input jpegs into an MJPEG. (`-codec:video copy`).