HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::levelizeImage

← levelImageColors   localContrastImage →

Example

function levelizeImage(
    string $image_path,
    float $black_point,
    float $gamma,
    float $white_point
) {
    $imagick = new \Imagick(realpath($image_path));

    $imagick->setFormat('png');
    $imagick->levelizeImage(
        $black_point * $imagick->getQuantum() / 255,
        $gamma,
        $white_point * $imagick->getQuantum() / 255
    );

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