Touch/mouse over to see original View modified in new window.
Image
Statistic type
Width
Height
Channel
function statisticImage($imagePath, $statisticType, $w20, $h20, $channel)
{
    $imagick = new \Imagick(realpath($imagePath));

    $imagick->statisticImage(
        $statisticType,
        $w20,
        $h20,
        $channel
    );

    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}