interpretation; $hue %= 360; if ($hue < 0) { $hue = 360 + $hue; } if ($image->hasAlpha()) { $imageWithoutAlpha = $image->extract_band(0, ['n' => $image->bands - 1]); $alpha = $image->extract_band($image->bands - 1, ['n' => 1]); return $imageWithoutAlpha ->colourspace(Interpretation::LCH) ->linear([$brightness, $saturation, 1.0], [0.0, 0.0, $hue]) ->colourspace($oldInterpretation) ->bandjoin($alpha); } return $image ->colourspace(Interpretation::LCH) ->linear([$brightness, $saturation, 1.0], [0.0, 0.0, $hue]) ->colourspace($oldInterpretation); } }