resize an overlay in a gif image

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
alealvaro
Posts: 7
Joined: 2016-08-18T19:43:26-07:00
Authentication code: 1151

resize an overlay in a gif image

Post by alealvaro » 2016-10-20T11:55:02-07:00

Hello!!

Please I need help with something. I have a gif image as a background, and I need to resize an overlay image which is a png.

By cli, I tried:

Code: Select all

convert +dither 600x339-star-wars.gif -coalesce null: ninja-100x100.png -geometry 200x+40+40 -layers composite -layers optimize test2.gif
This command works good if both images png. But when the main image is a gif, it doesn't. The geometry option put the image in the right place, but in it's original size without resize it.
I've been checking http://www.imagemagick.org/script/comma ... p#geometry

Images are:
600x339-star-wars.gif => https://thechive.files.wordpress.com/20 ... .gif?w=600
ninja-100x100.png => https://imagenes.es.sftcdn.net/es/scrn/ ... 00x100.png

I'm using: Version: ImageMagick 6.9.5-5 Q16 x86_64 2016-08-07 http://www.imagemagick.org

Thanks in advance!

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: resize an overlay in a gif image

Post by fmw42 » 2016-10-20T13:10:55-07:00

try

Code: Select all

convert 600x339-star-wars.gif -coalesce null: \( ninja-100x100.png -resize 200x -set page +40+40 \) -layers composite -layers optimize test2.gif

alealvaro
Posts: 7
Joined: 2016-08-18T19:43:26-07:00
Authentication code: 1151

Re: resize an overlay in a gif image

Post by alealvaro » 2016-10-20T14:04:34-07:00

fmw42 wrote:try

Code: Select all

convert 600x339-star-wars.gif -coalesce null: \( ninja-100x100.png -resize 200x -set page +40+40 \) -layers composite -layers optimize test2.gif
You're a genius! It worked! Thanks a lot!

User avatar
fmw42
Posts: 22095
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: resize an overlay in a gif image

Post by fmw42 » 2016-10-20T14:49:18-07:00

-geometry is a setting not an operator. So it won't do anything unless an operator that knows about it follows. In this case, you really needed to do a resize and then a page offset.

Post Reply