HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Colorize image

← colorDecisionListImage   colorMatrixImage →
Blends the fill color with each pixel in the image.

Example

function colorizeImage($image_path, $color, $opacity_color)
{
    $imagick = new \Imagick(realpath($image_path));
//    $opacity = $opacity / 255.0;
    $imagick->colorizeImage($color, $opacity_color);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();

//    $imagick = new \Imagick();
//    $imagick->newPseudoImage(640, 480, "magick:logo");
//    $imagick->colorizeImage($color, $opacityColor);
//
//    $imagick->setImageFormat('png');
//    $imagick->writeImage(__DIR__ . "/colourize_new.png");

}