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

Bob Friesenhahn <[email protected]> Wed, 29 Jan 2014 08:59:46 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.apis
Message-ID <[email protected]>
On Wed, 29 Jan 2014, Dragan Jotanovic wrote:
> 
>     Image rose("magick:rose");
>   Image watermark("watermark.png");
>   rose.composite(watermark, CenterGravity, CopyCompositeOp);
>   rose.write("destination.gif");
> 
> but I get black pixels in place of transparent pixels from watermark.png.
> I also tried setting rose.matte(true); and watermark.matte(true); without results.
> 
> Is there an easy way to accomplish this?

It seems that I provided wrong information about the default composite 
operator.  The GM manual page says that 'Over' is the default. 
Please use OverCompositeOp or AtopCompositeOp rather than 
CopyCompositeOp and then you should be happy.

The command line is apparently not using CopyCompositeOp.

You can test from the command line like:

   gm composite -compose Atop -gravity center watermark.png rose: destination.gif

   gm composite -compose Over -gravity center watermark.png rose: destination.gif

vs (wrong)

   gm composite -compose Copy -gravity center watermark.png rose: destination.gif

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

_______________________________________________
Graphicsmagick-apis mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-apis