Imagick colorizeImage Hex darker

I use PHP and Imagick to change the color of transparent PNG. PNG image - a simple form with a transparent background.

I use the colorizeImage function to change the color.

$img = new Imagick("shape.png"); $img->colorizeImage("#99ccff",0.0); 

#99ccff problem that Imagick shows 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)

http://www.2shared.com/photo/N3rGdoHG/shape3.html

+7
source share
3 answers

I thought I would answer this question, despite the fact that it is old. This is for everyone who has this problem.

I solved this for a project I'm working on, just using "Clut", like this:

 $img = new Imagick("shape.png"); $clut = new Imagick(); $clut->newImage(1, 1, new ImagickPixel('#99ccff')); $img->clutImage($clut); $clut->destroy(); 

Hope this helps someone else with this issue.

+4
source
  $img = new Imagick("shape.png"); $img->colorizeImage("#99ccff",0.0); 

This second parameter is opacity. If you set it to 1.0, it will correspond to # 99ccff 100%. You can set it to 0.5 to match 50% over the original layer, etc .:

  $img = new Imagick("shape.png"); $img->colorizeImage("#99ccff", 1.0); 
+2
source

You must specify opacity, and the opacity value MUST be an integer of 1,

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

or it doesnโ€™t work, I tested a bit and I think that to work with transparency you need to provide an alpha channel.

+1
source