HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

Imagick::separateImageChannel

← selectiveBlurImage   sepiaToneImage →
Separates a channel from the image and returns a grayscale image. A channel is a particular color component of each pixel in the image.
function separateImageChannel($image_path, $channel)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->separateimagechannel($channel);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}