简体   繁体   中英

PHP ImageMagick: How To Merge Animated GIF Into Static Canvas

i'm trying to add some animated gif into static image (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

尝试:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM