public function __construct() { parent::__construct(function (ImageInterface $image, Point $point) { $color = $image->getColorAt($point); $image->draw()->dot($point, $color->grayscale()); }); }
public function __construct() { parent::__construct(function (ImageInterface $image, Point $point) { $color = $image->getColorAt($point); $gray = min(255, round(($color->getRed() + $color->getBlue() + $color->getGreen()) / 3)); $image->draw()->dot($point, new Color(array('red' => $gray, 'green' => $gray, 'blue' => $gray))); }); }