Change Color of image using Imagick
So I have an image that has various shades of grey (I converted it to grayscale). And what I would like to allow the user to do is convert the image to a different color by selecting from a color picker (applying a hex code basically).
Where $this->shading is the grayscale image and $this->blank is an image with just a white background.
$shading = new Imagick($this->shading);
$this->blank->compositeImage($shading, Imagick::COMPOSITE_DEFAULT, 0,0);
The code does change the color of the grayscale image; but it doesn't do it 100% correctly. For example, if I open photoshop and use the color code #5780bd and change the shading image to that color by using the pencil tool or w/e, the image color is noticeably different.
If anyone has any advice on how to accomplish coloring a gray-scale image to a hex code then that would be great. I'm not sure whether the original image should be grayscale or if it should be black or white or anything in order to achieve correct colorization.