HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::transformImageColorspace

← transposeImage   transverseImage →
Transforms an image to a new colorspace.
TODO - there's some code in the eye color resolution demo that should be used here...

Example

function transformImageColorspace($image_path, $colorSpace, $channel_number)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->transformimagecolorspace($colorSpace);
    $imagick->separateImageChannel($channel_number);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}