I already got some great advice on the forums how to get the colorize function using imagefilter IMG_FILTER_COLORIZE.
The problem is that it doesn't work as I want it to work, the link below illustrates it best: http://expromo.pl/klienci/imagefilter/
I have a transparent png containing some kind of shape. I want to:
- Change the color of the shape just as Photoshop Layer Settings / Colorize would
- Preserve the transparency
- Save it as another PNG file
Here is my code:
$im = imagecreatefrompng('image.png');
imagealphablending($im, false);
if($im && imagefilter($im, IMG_FILTER_COLORIZE, 0,0,255,0))
{
imagepng($im, 'image-new.png');
imagedestroy($im);
}
On the link above: http://expromo.pl/klienci/imagefilter/
The first image is what I have. The second image is what I get, and the third image is what I want to get.
Big thanks in advance.