HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::levelImageColors

← levelImage   levelizeImage →

Example

function levelImageColors(
    string $image_path,
    $black_color,
    $white_color,
    bool $invert
) {
    $imagick = new \Imagick(realpath($image_path));

    $imagick->setFormat('png');
    $imagick->levelImageColors(
        $black_color,
        $white_color,
        $invert
    );

    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}