Page 1 of 1

Defining alpha

Posted: 2007-08-18T16:47:59-07:00
by ophiuci
I am trying to use MagickWand to combine two images where one image contains color and the other contains a b/w alpha image. I want to output a transparent png. Is there currently a way to accomplish this? Any help would be appreciated.


Re: Defining alpha

Posted: 2007-08-19T18:42:56-07:00
by ophiuci
Here is the code I ended up with. Does exactly what I needed:

Code: Select all

	MagickNegateImage($mgk_alpha, true);
	MagickSetImageType($mgk_alpha, MW_GrayscaleType);

	MagickSetImageFormat($mgk_color, "PNG");

	$result = MagickCompositeImage($mgk_color, $mgk_alpha, MW_CopyOpacityCompositeOp, 0, 0);

	header('Content-Type: image/png');
	MagickEchoImageBlob( $mgk_color );
Solution found from:


Posted: 2008-02-19T16:11:55-07:00
by mrBlaQ
wait, I'm replying to the wrong thread....