<?php
function levelImage($blackPoint, $gamma, $whitePoint) {
$imagick = new \Imagick();
$imagick->newPseudoimage(500, 500, 'gradient:black-white');
$imagick->setFormat('png');
$quantum = $imagick->getQuantum();
$imagick->levelImage($blackPoint / 100 , $gamma, $quantum * $whitePoint / 100);
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>