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

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
mrBlaQ
Posts: 17
Joined: 2008-02-05T12:19:00-07:00

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

Post by mrBlaQ » 2008-02-19T16:00:09-07:00

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 208.42.140.15] MagickCropImage
[Tue Feb 19 16:57:17 2008] [error] [client 208.42.140.15] MagickSetImageFormat
Can anyone provide some insight on the proper way to accomplish this task?

Thanks,
Dave

mrBlaQ
Posts: 17
Joined: 2008-02-05T12:19:00-07:00

Solved

Post by mrBlaQ » 2008-02-19T16:18:14-07:00

I needed to add...

Code: Select all

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

Post Reply