Touch/mouse over to see original View modified in new window.
Image
Threshold color
 
function blackThresholdImage($imagePath, $thresholdColor)
{
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->blackthresholdimage($thresholdColor);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}