diff --git a/src/Modifiers/BrightnessModifier.php b/src/Modifiers/BrightnessModifier.php index 7e75bd1..421d07e 100644 --- a/src/Modifiers/BrightnessModifier.php +++ b/src/Modifiers/BrightnessModifier.php @@ -22,13 +22,13 @@ public function apply(ImageInterface $image): ImageInterface $mask = $image->core()->native()->extract_band($image->core()->native()->bands - 1, ['n' => 1]); $brightened = $flatten - ->linear([1, 1, 1], [$this->level, $this->level, $this->level]) + ->linear(1, $this->level) ->bandjoin($mask) ->cast($image->core()->native()->format) ; } else { $brightened = $image->core()->native() - ->linear([1, 1, 1], [$this->level, $this->level, $this->level]) + ->linear(1, $this->level) ->cast($image->core()->native()->format) ; } diff --git a/src/Modifiers/ColorizeModifier.php b/src/Modifiers/ColorizeModifier.php index 99ad386..7ceab4e 100644 --- a/src/Modifiers/ColorizeModifier.php +++ b/src/Modifiers/ColorizeModifier.php @@ -21,7 +21,7 @@ public function apply(ImageInterface $image): ImageInterface $image->core()->setNative( $image->core()->native()->linear( - array_fill(0, $bands, 1), + 1, array_pad(array_map(fn(int $value): int => $value * 3, [ $this->red, $this->green, diff --git a/src/Modifiers/ContrastModifier.php b/src/Modifiers/ContrastModifier.php index d7c3899..bb7bee5 100644 --- a/src/Modifiers/ContrastModifier.php +++ b/src/Modifiers/ContrastModifier.php @@ -26,13 +26,13 @@ public function apply(ImageInterface $image): ImageInterface $mask = $image->core()->native()->extract_band($image->core()->native()->bands - 1, ['n' => 1]); $brightened = $flatten - ->linear([$a, $a, $a], [$b, $b, $b]) + ->linear($a, $b) ->bandjoin($mask) ->cast($image->core()->native()->format) ; } else { $brightened = $image->core()->native() - ->linear([$a, $a, $a], [$b, $b, $b]) + ->linear($a, $b) ->cast($image->core()->native()->format) ; } diff --git a/tests/Unit/Analyzers/PixelColorAnalyzerTest.php b/tests/Unit/Analyzers/PixelColorAnalyzerTest.php index 1ada525..1e621a8 100644 --- a/tests/Unit/Analyzers/PixelColorAnalyzerTest.php +++ b/tests/Unit/Analyzers/PixelColorAnalyzerTest.php @@ -34,7 +34,7 @@ public function testAnalyzeFloatFormat(): void $image->core()->setNative( $image->core()->native() - ->linear([1, 1, 1], [30, 30, 30]) + ->linear(1, 30) ->cast($format) );