Page 1 of 1

How to place a GIF on another GIF, where both GIFs are of different sizes.

Posted: 2018-03-27T03:53:22-07:00
by raw
I have two GIFs of different sizes. I want to be able to place a GIF2 to a background GIF1 at a specific location and at the same time add text to the result. I am new to ImageMagick world, please help.

I am trying to achieve the following result where dog sticker is in a separate GIF.

Image

Re: How to place a GIF on another GIF, where both GIFs are of different sizes.

Posted: 2018-03-27T10:30:42-07:00
by fmw42
Do the two animations have the same delays and number of frames? If not, see https://www.imagemagick.org/Usage/anim_mods/#merging.

It would help if you post your two animations and background image as well as tell us your IM version and platform.

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown

Re: How to place a GIF on another GIF, where both GIFs are of different sizes.

Posted: 2018-03-27T12:14:51-07:00
by fmw42
If your animations have the same delay and number of frames, you can do:

Background:
Image

Animation1:
Image

Animation:2
Image



Code: Select all

convert skyblue.gif \
null: \
\( morph_anim_1pt.gif -coalesce \) \
-gravity northwest -geometry +20+20 -compose over -layers composite \
null: \
morph_anim_5pts.gif \
-gravity southeast -geometry +20+20 -compose over -layers composite \
-layers optimize \
result.gif
Image

Re: How to place a GIF on another GIF, where both GIFs are of different sizes.

Posted: 2018-03-27T15:08:34-07:00
by fmw42
Perhaps this is more what you want. Imagemagick command line code in unix syntax:

The background animation has 3 frames and foreground one has 11 frames. So I repeat the background 4 times and remove the last frame so there is a total of 11 frames for the background. I coalesce the animation and add text to each frame using -annotate. Then I use -layers composite to overlay the foreground animation onto the background.

Background:
Image

Foreground:
Image


Code: Select all

convert -delay 20 \
\( glitter_blue_tiled.gif glitter_blue_tiled.gif \
glitter_blue_tiled.gif glitter_blue_tiled.gif \
-coalesce \
+delete -font arial -pointsize 28 -gravity north \
-annotate +0+20 "TESTING" \) \
null: \
\( coalesced_k.gif -coalesce \) \
-gravity south -geometry +0+20 \
-compose over \
-layers composite \
-layers optimize \
-loop 0 \
result2.gif
Image