I need your help with merging several animated images

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
marke

I need your help with merging several animated images

Post by marke »

I have a serious problem trying to merge several animated images.
help me!
http://www.cq100.cn/indemand/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: I need your help with merging several animated images

Post by fmw42 »

marke wrote:I have a serious problem trying to merge several animated images.
help me!
http://www.cq100.cn/indemand/
I am no expert on these matters. Hopefully you can get some help from Anthony. But you have to consider that in gen eral the number of frames and delays per frame should be the same otherwise it is much harder. See http://www.imagemagick.org/Usage/anim_mods/#complex
marke

Re: I need your help with merging several animated images

Post by marke »

"But you have to consider that in gen eral the number of frames and delays per frame should be the same otherwise it is much harder."
That's the point!
The number of frames and delays per frame is not the same at all...
Disappointed, maybe nobody can solve it.......
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: I need your help with merging several animated images

Post by fmw42 »

marke wrote:"But you have to consider that in gen eral the number of frames and delays per frame should be the same otherwise it is much harder."
That's the point!
The number of frames and delays per frame is not the same at all...
Disappointed, maybe nobody can solve it.......
The best I can offer is again to look at Anthony's pages and in particular http://www.imagemagick.org/Usage/anim_mods/#merge for Merging Time Disjoint Animations
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: I need your help with merging several animated images

Post by anthony »

First this should be in the users forum rather than the developers forum.

However essentually what I have listed in the 'merge' reference above is what is needed. first you need to sort out and duplicate (time wise) each animation so they have the same loop length, the same number of frames, and the same time index at each frame. Typically that is done by duplicating a frame in on animation so the time index (since start of animation) is the same as an examisting frame in the other animation.

For example supose you have two animations of three frame with time delays of
10 10 10
5 5 20
both animations are 30 time units long already so that is not a problem.
Now convert the above to the time index when each frame should appear...
0 10 20 __ both loops
0 5 10 at 30
from this you can see that you need to insert some extra frames to make them match the first frame of the first animatio needs to be repeated a 5
0,5 10 20
0 5 10

Now the last frame of the second animation also needs to be duplicated at time index 20
0,5 10 20
0 5 10, 20

where the ',' means the same frame is just repeated.
Now the frames can be merged (composited) together and you get a you get a single merged animation 4 frames long from the two 3 frame animations.

I have added the above to the raw notes for merging animations
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply