/** * (non-PHPdoc) * @see Imagine\ImageInterface::histogram() */ public function histogram() { $pixels = $this->gmagick->getimagehistogram(); return array_map(function (\GmagickPixel $pixel) { $info = $pixel->getColor(); return new Color(array($info['r'], $info['g'], $info['b']), (int) round($info['a'] * 100)); }, $pixels); }
/** * {@inheritdoc} */ public function histogram() { try { $pixels = $this->gmagick->getimagehistogram(); } catch (\GmagickException $e) { throw new RuntimeException('Error while fetching histogram', $e->getCode(), $e); } $image = $this; return array_map(function (\GmagickPixel $pixel) use($image) { return $image->pixelToColor($pixel); }, $pixels); }