Page 1 of 1

semi-transparent pixels

Posted: 2008-01-22T15:18:25-07:00
by dsl
Hello all.

I have the following situation.

Background image is transparent PNG image.
Image its self in JPG format.
Mask in PNG format.

I try to do a composite.

convert background.png image.jpg mask.png -composite result.png

But I lose semi-transparency this way.
If I use white background there is no problem.

Could you please advise, how I can save semi-trasparent pixels when composite ?

Re: semi-transparent pixels

Posted: 2008-01-23T09:04:54-07:00
by dsl
Please, could anybody advise?

Here are images that I use in composite:
Mask
Image

Result with transparent background
Image

Result with white background
Image

Notice, when transparent background is used, edges are not smooth.

Re: semi-transparent pixels

Posted: 2008-01-24T17:54:14-07:00
by fmw42
Post your source images as well as the mask.

Generally the background and overlay (first and second) images are not transparent. You may want to review

http://www.imagemagick.org/Usage/compose/

and

http://www.imagemagick.org/Usage/channels/#masks

Re: semi-transparent pixels

Posted: 2008-01-30T19:44:02-07:00
by anthony
I believe you have a very old ImageMagick. The 3 image masked composition was a boolean or binary up until Im version 6.3.4-11.

But there are lots of ways to skin that cat!

One alternative is to take the first image, and use the mask to shape that image before overlaying it on your background.

Examples of this is
http://imagemagick.org/Usage/compose/#copyopacity
http://imagemagick.org/Usage/fonts/#mask
http://imagemagick.org/Usage/channels/#masks
Especially the example immediateally before that last.

Another method is to directly use the mask (probably negated) to just make the areas you want white white, by using a 'screen' composition. More on this is..
http://imagemagick.org/Usage/compose/#screen
http://imagemagick.org/Usage/channels/#compose