Overlaying animated gif on jpeg

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
defied

Overlaying animated gif on jpeg

Post by defied »

Hello,

I'm having a problem when overlaying an animated gif over a jpeg file.
Here is what I use:

Code: Select all

 convert source.jpg \
            \( -clone 0 bigheart-0.gif -composite -geometry +30+30 \) \
            \( -clone 0 bigheart-1.gif -composite -geometry +30+30  \) \
            \( -clone 0 bigheart-2.gif -composite -geometry +30+30 \) \
            -delete 0 -set delay 25  output.gif
the image generated is the source image with the animated gif ontop, but I can't seem to position the animated overlay.
How do I position the animated layer to a certain position?
Also, is there an easier way than the method I use? I need to +adjoin an animated gif, only then I can use the animated gif to put over the source jpeg.

Thank you,
Joe
defied

Re: Overlaying animated gif on jpeg

Post by defied »

I think I found a solution

Code: Select all

convert source.jpg \
            \( -clone 0 bigheart-0.gif -geometry +30+10 -composite \) \
            \( -clone 0 bigheart-1.gif -geometry +30+10 -composite \) \
            \( -clone 0 bigheart-2.gif -geometry +30+10 -composite \) \
            -delete 0 -loop 0 output.gif
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Overlaying animated gif on jpeg

Post by anthony »

You may also like to look at IM Examples, Remove transparency
http://www.imagemagick.org/Usage/animat ... pose_under

Basically you can use -draw to underlay an image under each frame of an animation of unknown length and size.

Code: Select all

convert bigheart_animation.gif  -coalease \
            -draw 'image DstOver 0,0 0,0 "source.jpg"' \
            -layers optimize     bigheart_background.gif
the final size of the animation is as per the origianl animation.

I had planed to create a 'underlay a background' section, but it basically would repeat that simple example.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply