Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have five gifs all with the same number of frames and the same framerate. Is it possible to montage these together into one gif where each frame is similar to a normal montage of static images and is the next frame in the gif. Furthermore, i would want the first two gifs on the first row, then a space, then the last three gifs.

share|improve this question
add comment

1 Answer

If I understood you correctly, you want one animated gif that looks like 5 animated gifs playing in parallel, right?

Imagemagick can do that (and much more). Probably even in one line of code, but I'll do it in several steps. Lets assume your gifs are called anim1.gifanim5.gif and are each 100x100 pixels.

#Combine anim1.gif and anim2.gif (first row)
convert anim1.gif -repage 200x100 -coalesce null: \( anim2.gif -coalesce \) -geometry +100+0 -layers Composite anim1+2.gif
#Combine anim3.gif and anim4.gif (1st part of last row)
convert anim3.gif -repage 200x100 -coalesce null: \( anim4.gif -coalesce \) -geometry +100+0 -layers Composite anim3+4.gif
#Combine anim3+4.gif and anim5.gif (last row)
convert anim3+4.gif -repage 300x100 -coalesce null: \( anim5.gif -coalesce \) -geometry +200+0 -layers Composite anim3+4+5.gif
#Combine all, leaving one in the middle empty
convert anim1+2.gif -repage 300x300 -coalesce null: \( anim3+4+5.gif -coalesce \) -geometry +0+200 -layers Composite anim_all.gif

The technique is described in more detail here (“Layered Composition“)

The final result (with animations examples from the imagemagick web page) looks like this: animated gif

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.