Touch/mouse over to see original View modified in new window.
Width
Height
Image
Offset
function adaptiveThresholdImage($imagePath, $width, $height, $adaptiveOffset)
{
    $imagick = new \Imagick(realpath($imagePath));
    $adaptiveOffsetQuantum = intval($adaptiveOffset * \Imagick::getQuantum());
    $imagick->adaptiveThresholdImage($width, $height, $adaptiveOffsetQuantum);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}