Problem composing images with alpha channel

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rich2449
Posts: 11
Joined: 2010-03-18T11:34:10-07:00
Authentication code: 8675308

Problem composing images with alpha channel

Post by rich2449 »

Using the Magick++ api I've created two Magick::Image objects, cleared one to blue, and drawn a red square on the other. Both of these images have been saved out to disk to verify their contents, both are correct. The square is drawn directly into a pixel cache, setting the r,g,b, and opacity for each pixel.

Try as I may, I can't get the composite function to work as it should and obey the alpha (opacity) information on the square image.

I've tried setting the matte and type properties on both image objects, but this didn't seem to help.

The resulting image always appears as a direct copy the red square, disregarding the alpha...

What am I missing?

Code: Select all

		imageBlue.matte( true );
		imageBlue.type( MagickCore::TrueColorMatteType );
		imageBlue.compose( MagickCore::OverCompositeOp );

		imageRed.matte( true );
		imageRed.type( MagickCore::TrueColorMatteType );
		imageRed.compose( MagickCore::OverCompositeOp );

		imageBlue.composite( imageRed, image.geometry, MagickCore::OverCompositeOp );
Thanks in advance,
Rich
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Problem composing images with alpha channel

Post by anthony »

I suggest you also post on the Specific Magick++ API forum.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply