$imagick = new \Imagick(); $imagick->newPseudoImage(640, 480, "magick:logo"); $histogramElements = $imagick->getImageHistogram(); $lastColor = array_pop($histogramElements); $color = $lastColor->getColor(); $output = sprintf( "ColorCount last pixel = %d\nColor is R %d G %d B %d", $lastColor->getColorCount(), $color['r'], $color['g'], $color['b'] ); return nl2br($output);