Blends the fill color with each pixel in the image.
Touch/mouse over to see original View modified in new window.
Image
Color
 
Opacity
Blends the fill color with each pixel in the image.
Parameters
colorizemixedImagickPixel object or a string containing the colorize color
opacitymixedImagickPixel object or an float containing the opacity value. 1.0 is fully opaque and 0.0 is fully transparent.
function colorizeImage($imagePath, $color, $opacity)
{
    $imagick = new \Imagick(realpath($imagePath));
    $opacity = $opacity / 255.0;
    $opacityColor = new \ImagickPixel("rgba(0, 0, 0, $opacity)");
    $imagick->colorizeImage($color, $opacityColor);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}