HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::negateImage

← motionBlurImage   newPseudoImage →
Negates the colors in the reference image. The Grayscale option means that only grayscale values within the image are negated.

Example

function negateImage($image_path, $grayOnly, $channel)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->negateImage($grayOnly, $channel);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}