- $index = imagecolorat($this->image, $x, $y);
- $colors = imagecolorsforindex($this->image, $index);
-
- $row[] = [$colors['red'], $colors['green'], $colors['blue']];
+ if ($image->isImagick()) {
+ try {
+ $colors = $image->image->getImagePixelColor($x, $y)->getColor();
+ } catch (\Throwable $th) {
+ return '';
+ }
+ $row[] = [$colors['r'], $colors['g'], $colors['b']];
+ } else {
+ $index = imagecolorat($image->image, $x, $y);
+ $colors = @imagecolorsforindex($image->image, $index);
+ $row[] = [$colors['red'], $colors['green'], $colors['blue']];
+ }