Page 1 of 1

Problem composing images with alpha channel

Posted: 2010-05-13T08:07:04-07:00
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

Re: Problem composing images with alpha channel

Posted: 2010-05-16T18:42:48-07:00
by anthony
I suggest you also post on the Specific Magick++ API forum.