Some colours go black...others go white, some remain the same.
Some colours go black...others go white, some remain the same.
function rangeThresholdImage(
    $image_path,
    float $low_black,
    float $low_white,
    float $high_white,
    float $high_black
) {
    $imagick = new \Imagick(realpath($image_path));
    $imagick->rangeThresholdImage(
        $low_black * \Imagick::getQuantum(),
        $low_white * \Imagick::getQuantum(),
        $high_white * \Imagick::getQuantum(),
        $high_black * \Imagick::getQuantum()
    );
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}