如何使用ImageMagick将GIF放置在另一个GIF上,其中两个GIF的大小均不同 [英] How to place a GIF on another GIF with ImageMagick, where both GIFs are of different sizes

查看:231
本文介绍了如何使用ImageMagick将GIF放置在另一个GIF上,其中两个GIF的大小均不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个大小不同的GIF.我希望能够将一个动画GIF放置在特定位置的静态背景GIF上,同时在结果中添加文本.我是ImageMagick世界的新手,请帮助.

I have two GIFs of different sizes. I want to be able to place one animated GIF onto a static background GIF at a specific location and at the same time add text to the result. I am new to ImageMagick world, please help.

当狗贴在单独的GIF中时,我试图获得以下结果.

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

推荐答案

也许这正是您想要的. Unix语法中的Imagemagick命令行代码:

Perhaps this is more what you want. Imagemagick command line code in unix syntax:

背景动画有3帧,前景动画有11帧.因此,我将背景重复4次并删除最后一帧,因此背景总共有11帧.我合并动画,并使用-annotate将文本添加到每个帧.然后,我使用-layers Composite将前景动画叠加到背景上.

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.

背景:

前景:

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 -fill black -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

这篇关于如何使用ImageMagick将GIF放置在另一个GIF上,其中两个GIF的大小均不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆