Create an animated GIF on linux

Even though it is possible to create an animated gif on any linux machine using GIMP I found out that when
I followed one of the many on-line guides (there are many but you can try this one and this) the resulting animated
gifs had a number of problems with the color conversions.

Even though I am pretty certain that there is a way in GIMP to fix those since I am not a graphics designer
and have little to zero knowledge of the workings of GIMP I turned to the trusted ffmpeg so some magic

So to create an animation we use the convert command

convert -delay 50 frame1.gif frame1.gif frame1.gif -loop 0 animated.gif

This will create an animated gif of 3 frames with 50 ms delay between them looping indefinitely.
If we need a varied delay between the images we can specify the delay before each seperate frame

convert -delay 50 frame1.gif -delay 100 frame1.gif -delay 150 frame1.gif -loop 0 animated.gif

Also if we want to add a pause between each loop

convert -delay 50 frame1.gif -delay 100 frame1.gif -delay 150 frame1.gif -loop 0 -pause 200 animated.gif

Also using convert we can combine 2 animated gifs

convert anim1.gif anim2.gif combined.gif


Tips & tricks: