Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
how-to.ytmnd.com –  Ƭᴇcʜιᴇ007 Apr 7 '13 at 3:00
1  
I'm going to take that as it probably wasn't intended; as a serious comment. Yes, I want to tile GIFs. But permanently, not in HTML. Thank you for the link. I will save that particular GIF for later use. –  tsbertalan Apr 8 '13 at 3:12

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.