Is there some way to use imagemagic / montage to tile looped animated gifs (intermixed with nonanimated ones)?

That is, I want to concatenate the animations in space, not in time. I realize that the number of frames and their duration in the animation might make it impossible to neatly combine two animations. But I'm fine with the program making approximations and guesses, and extending/repeating frames, as long as all the frames are there in some fashion.

I've tried

convert *.gif -append output.gif

and

montage *.gif -mode concatenate -tile x1 output.gif

but these both treat the animated gifs as multiple individual non-animated ones.

I suppose I could probably write a script to break the animated ones apart by frames, repeat / extend shorter loops as necessary to match the longest loop, repeat the nonanimated gifs for as many frames are in the longest animated one, stitch together the corresponding frames into single large frames with -append, and then combine those large frames into one large gif. But I don't want to reinvent the wheel if this is already possible by some simple command.

I'm of course open to other free options besides imagemagick.


It sounds like you want to match up several animations through time, but that's going to take a program to read each frame and its delay, then output that frame at some periodic frequency until the delay is met. eg: 1 frame, delay of 1 second, and your 'frequency' is 100ms, so you'd want 10 frames at 100ms written out? And then converted to a linear montage?

That would need a program or hefty script to perform that kind of processing, and you'd have to define your 'frequency' (100ms here).

But this works nicely: (gifsicle is a package, montage is part of the imagemagick package)

gifsicle --unoptimize cool_animation.gif | \
  montage -tile x1 - linear_frames.png

(line broken for readability)

First line breaks apart the incoming gif into individual frames (to stdout), but with the layers filled out. initially, without the --unoptimize option, it would give the first frame, but the subsequent frames only contained what changed each time. Made for weird montages!

Second line builds the linear output, taking each frame image (from stdin) and arranging them in the order you specify. 'x1' to arrange them along a horizontal line.

You could replace the single filename (cool_animation.gif) with several, or even a wildcard *.gif.

I not sure this is what you're looking for though.