Пример #1
0
 /**
  * (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);
 }
Пример #2
0
 /**
  * {@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);
 }