开发者

PHP ImageMagick: How To Merge Animated GIF Into Static Canvas

开发者 https://www.devze.com 2023-02-28 11:46 出处:网络
i\'m trying to add some animated gif into static imag开发者_运维技巧e (canvas), here\'s my start code

i'm trying to add some animated gif into static imag开发者_运维技巧e (canvas), here's my start code

exec("convert  canvas.gif animated.gif result.gif");

with that code, animated gif will placed on top left canvas.

My question is how to make adjustment position of animated in canvas area and maybe resize this animated gif before merge?

Please note, with code above, will add 1 frame extra to result, i dont know how to fix this :(

Update: My latest code on PHP

$cmd = "convert $animation -gravity center -geometry +0+5 null: $watermark -layers composite -layers optimize GIF:-";

header("Content-type: image/gif");
passthru($cmd, $retval);

Now frames are same with animated source, but sometimes GIF like loosing background frame :( this is image example for finish result

http://i.stack.imgur.com/xxGzV.gif

How to make background frame looping forever?

Thanks and regards nb: sorry for bad english ..lol


try:

convert background.jpg animation.gif -loop 0  new_animation.gif
0

精彩评论

暂无评论...
验证码 换一张
取 消