1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-29 09:47:36 +01:00

Enable importing of "foreign" color spaces

This change makes it possible to use color specifications from all
possible color spaces as input - even if the color space differs from
the image or is not supported by the driver.
This commit is contained in:
Oliver Vogel 2023-12-01 14:31:32 +01:00
parent 05059e7f1f
commit 92b4cfea8e

View File

@ -21,6 +21,10 @@ class ColorProcessor implements ColorProcessorInterface
public function colorToNative(ColorInterface $color): int
{
// convert color to image colorspace
$color = $color->convertTo($this->colorspace);
// gd only supports rgb so the channels can be accessed directly
$r = $color->channel(Red::class)->value();
$g = $color->channel(Green::class)->value();
$b = $color->channel(Blue::class)->value();