Problem setting background color for wave image operation

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
SkipperMcNally

Problem setting background color for wave image operation

Post by SkipperMcNally »

I have trying to apply a wave operation on an image and have the added areas be transparent and having no luck. Any suggestions?

Here is the code:

Code: Select all

$testImagick = new Imagick("input.jpg");
$testImagick->setImageFormat("png");
$testImagick->setBackgroundColor(new ImagickPixel("transparent"));
$testImagick->waveImage(20, $testImagick->getImageWidth() * 2);
The added area is always white, even when I try blank and Red as colors.

Thanks for any help.
SkipperMcNally

Re: Problem setting background color for wave image operation

Post by SkipperMcNally »

Nevermind, I found this old bug report thread that told me I should be using setImageBackgroundColor() instead.

Thread:
http://pecl.php.net/bugs/bug.php?id=12444

Working code:

Code: Select all

$testImagick = new Imagick("input.jpg");
$testImagick->setImageFormat("png");
$testImagick->setImageBackgroundColor(new ImagickPixel("transparent"));
$testImagick->waveImage(20, $testImagick->getImageWidth() * 2);
Post Reply