Page 1 of 1

Overlaying Animation Above Animation

Posted: 2008-01-24T08:19:37-07:00
by renxiii
I have this two images
text.gifImage
outline.gifImage

I want to Put the outline.gif above the text.gif

i use this command
convert text.gif null: outline.gif -matte -compose srcatop -layers composite -loop 0 glitter_outline.gif

but i got this output
Image

This is not what i expected because the outline.gif is alternating with the text.gif
i want to show them at the same time

please help for the correct command...thnx

Re: Overlaying Animation Above Animation

Posted: 2008-01-24T17:25:35-07:00
by fmw42
I am no expert at animation, but your two animation do not have the same number of frames and I suspect this will be key to overlaying them one-to-one.

identify text.gif
text.gif[0] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[1] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[2] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[3] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[4] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[5] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[6] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[7] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[8] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[9] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[10] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[11] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[12] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[13] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[14] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[15] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[16] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[17] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[18] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[19] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[20] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[21] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[22] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[23] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[24] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[25] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
text.gif[26] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 176.459kb
identify outline.gif
outline.gif[0] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 30.9766kb
outline.gif[1] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 30.9766kb
outline.gif[2] GIF 250x234 250x234+0+0 PseudoClass 256c 8-bit 30.9766kb


You either want to repeat the frames of the outline.gif to fill the same number of frames as in text.gif or choose one frame from the outline.gif and overlay it on each frame of the text.gif

Re: Overlaying Animation Above Animation

Posted: 2008-01-24T19:15:05-07:00
by renxiii
so do you mean there is no other shorter command if both animation have different # of frames?
:D

Re: Overlaying Animation Above Animation

Posted: 2008-01-25T17:30:57-07:00
by fmw42
As the outline.gif has 3 frames and the text.gif has 27 frames, they are multiples of each other. So just merge the outline 9 times to match the number of frames


convert \( text.gif -coalesce \) null: \( outline.gif outline.gif outline.gif outline.gif outline.gif outline.gif outline.gif outline.gif outline.gif -coalesce \) -layers Composite text_outline.gif

or

convert \( text.gif -coalesce \) null: \( outline.gif -write mpr:outline +delete \) \( mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline -coalesce \) -layers Composite text_outline.gif


Both work for me with your two images.

Re: Overlaying Animation Above Animation

Posted: 2008-01-26T21:37:35-07:00
by renxiii
it worked for me to... thanks a lot.
:D

Re: Overlaying Animation Above Animation

Posted: 2008-01-28T22:28:27-07:00
by anthony
renxiii wrote:so do you mean there is no other shorter command if both animation have different # of frames?
:D
I have outlined the method that would be used to merge two animations that have the same overall 'cycle time' though different number of frames.

See IM examples
Merging Time Disjoint Animations
http://imagemagick.org/Usage/anim_mods/#merge

Basically you need to double up and split the times on frames in each animation until the frame by frame timings of the animations match up, (and then animations also have the same number of frames). At that point the -layers composite can be used as descriped previously on the same page to do the overlay, and frame optimization can be used to make the animation smaller.

I had planned to create a simple -layers operation in IM to actually do this time synchronization, but I just never seem to get around to doing more programming in IM core.

PS; I would coaleasce the outline.gif animation ONCE, then use either -clone, or a -write MPR:label method.
See http://imagemagick.org/Usage/files/#mpr
and http://imagemagick.org/Usage/basics/#clone



Im really needs more people willing to to try and submit complete patches and additions to IM. Once there ability is proven, more direct SVN access to the source can be provided.

Re: Overlaying Animation Above Animation

Posted: 2008-02-03T20:43:55-07:00
by anthony
fmw42 wrote:

Code: Select all

convert \( text.gif -coalesce \) null: \( outline.gif -write mpr:outline +delete \) \( mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline mpr:outline -coalesce \) -layers Composite text_outline.gif
One point about mpr: you can things of it as a multi-image save. Rather than just saving a single copy of the 'outline.gif' (and deleting the original) why not use it to copy 3 versions.

You don't even need to delete the original, and you can copy it more times than needed as it is the destination (first) sequence that determine the final number of images.

Code: Select all

convert \( text.gif -coalesce \) null: \
    \( outline.gif -coalesce  -write mpr:outline \
        mpr:outline mpr:outline -write mpr:outlineX3 \
        mpr:outlineX3  mpr:outlineX3  mpr:outlineX3  \) \
   -layers Composite    text_outline.gif
this overlays 12 repeated copys of the outline (12 x 3 or 36 frames) only the animated text (27 frames) to produce a 27 frame image. This whay you can make your script a bit more forgiving if the number of frames in the text image changes.

the use of mpr: to double, treble the number of frames is ver efficient. you can very quickly make a 1000 image sequence in this way without too many commands.

Cloning images using -clone OR mpr: is also highly memory efficient as the images are not being modified. As such the image data is not being duplicated or copied.