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:
parent
05059e7f1f
commit
92b4cfea8e
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user