Imagick colorizeImage Hex darker

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
pelelive
Posts: 1
Joined: 2011-11-19T15:46:52-07:00
Authentication code: 8675308

Imagick colorizeImage Hex darker

Post by pelelive »

Hi all,

I use PHP and Imagick to change the color of a transparent PNG. The image in the PNG is a simple shape with a transparent background.

I use the colorizeImage function to change the color.

Code: Select all

$img = new Imagick("shape.png"); 
$img->colorizeImage("#99ccff", 1); 
The problem is that Imagick show a dark version of my HEX code (#99ccff)?

Is there a way to get the exact color (#99ccff)?

(my PNG is PNG 32 - and the shape is black)

here is my file: http://www.2shared.com/photo/N3rGdoHG/shape3.html

If you have a better way to change the color of a png file with a one color shape, please post it.

Thank you for all your help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagick colorizeImage Hex darker

Post by fmw42 »

$img->colorizeImage("#99ccff", 1);

Perhaps specify the opacity value as a float.


$img->colorizeImage("#99ccff", 1.0);
Post Reply