function claheImage( $image_path, int $width, int $height, int $number_bins, float $clip_limit ) { $imagick = new \Imagick(realpath($image_path)); $imagick->claheImage( $width, $height, $number_bins, $clip_limit * Imagick::getQuantum() ); header("Content-Type: image/jpeg"); echo $imagick->getImageBlob(); }