Re: Compositing transparent png over image using Magick++ GraphicsMagick API

Bob Friesenhahn <[email protected]> Tue, 28 Jan 2014 16:36:39 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <[email protected]>
On Tue, 28 Jan 2014, Dragan Jotanovic wrote:

> Thanks for the quick response.I'm not trying to create transparent jpeg, I'm trying to compose transparent png onto an image,
> so that only non-transparent pixels are composed.
> For example, when I execute this from command line:
> gm compose watermark.png source.jpg destination.jpg
> I get the desired effect. Only non-transparent pixels from png image are composed to destination image.
> What I'm interested in is how to achive this with magick++ api?

Anything creatable at the command line can be done via the Magick++ 
API.  You are using DissolveCompositeOp but the default composition 
operator (from your command-line example) would be CopyCompositeOp.

You can make an originally opaque image support transparency by using 
image.matte(true);.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk