Skip to content

Commit

Permalink
Limit color analyzer value to min. 0
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Jan 12, 2025
1 parent fc881ae commit 4f9cddc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Analyzers/PixelColorAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function colorAt(ColorspaceInterface $colorspace, VipsImage $vipsImage
return $this->driver()
->colorProcessor($colorspace)
->nativeToColor(array_map(
fn(int|float $value): int => (int) min($value, 255),
fn(int|float $value): int => (int) max(min($value, 255), 0),
$vipsImage->getpoint($x, $y)
));
}
Expand Down

0 comments on commit 4f9cddc

Please sign in to comment.