Page 1 of 1

Problem trying to convert a JPG to PNG and add an alpha mask

Posted: 2008-02-19T16:00:09-07:00
by mrBlaQ
I'm trying to convert a JPG to a PNG and add an alpha mask. Here's the code I have currently. My script dies during MagickSetImageAlphaChannel and error_reporting(E_ALL) doesn't say why.

Code: Select all

            MagickSetImageFormat($wnd, "PNG32");
            error_log("MagickSetImageFormat", 0);
            MagickSetImageAlphaChannel($wnd, MW_ActivateAlphaChannel);
            error_log("MagickSetImageAlphaChannel", 0);
            MagickEvaluateImage($wnd, MW_DivideEvaluateOperator, (100/$alpha), MW_AlphaChannel);
            error_log("MagickEvaluateImage", 0);
My php error log only reports the following, it never makes it to MagickEvaluateImage():

Code: Select all

[Tue Feb 19 16:57:17 2008] [error] [client] MagickCropImage
[Tue Feb 19 16:57:17 2008] [error] [client] MagickSetImageFormat
Can anyone provide some insight on the proper way to accomplish this task?



Posted: 2008-02-19T16:18:14-07:00
by mrBlaQ
I needed to add...

Code: Select all

MagickSetImageType($wnd, MW_TrueColorMatteType);
Before my MagickEvaluateImage() function.