Page 1 of 1

png transparency when overlaying two images

Posted: 2009-11-25T11:59:43-07:00
by chainas
Hello,

i tried to find similar problem using search, but no exact results found. So i will try to explain my problem.

Image one (background): Image

Image two (image over background): Image

Expected result (overlayed image): Image

I made it local in my cmd (on windows) with this command:

Code: Select all

composite -geometry +60+40 manutd.png bg.jpg overlayed.jpg
But when i try to do this command in my symfony php sfImageMagickAdapter class file, i getting black background of manutd.png image.

So my question is, maybe there are some additional overlaying parameters to overlay those images more correclty ?

Thanks for answers

Re: png transparency when overlaying two images

Posted: 2009-11-25T12:23:58-07:00
by Bonzo
Some examples here:
http://www.rubblewebs.co.uk/imagemagick ... ompose.php
More detail here:
http://www.imagemagick.org/Usage/compose/

You should use -gravity with -geometry:

Code: Select all

composite manutd.png bg.jpg -gravity northwest -geometry +60+40  overlayed.jpg

Re: png transparency when overlaying two images

Posted: 2009-11-25T12:46:11-07:00
by chainas
I tried Your suggestions, but still no result.

Re: png transparency when overlaying two images

Posted: 2009-11-25T12:47:37-07:00
by Bonzo
You can use convert as well:

Code: Select all

convert bg.jpg manutd.png -gravity northwest -geometry +60+40 -composite overlayed.jpg
Note the order of images changes.

Re: png transparency when overlaying two images

Posted: 2009-11-25T13:16:50-07:00
by chainas
Yeach, but still no result. Maybe i need to remove somehow the background of png image before overlaying ?

Re: png transparency when overlaying two images

Posted: 2009-11-25T13:32:59-07:00
by Bonzo
I used your images and they worked OK.

When you run this from the command prompt do you get a rw- next to png, png24, png32 and png8

Code: Select all

convert -list Format