mirror of
https://github.com/Intervention/image.git
synced 2025-08-11 00:14:03 +02: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:
@@ -21,6 +21,10 @@ class ColorProcessor implements ColorProcessorInterface
|
|||||||
|
|
||||||
public function colorToNative(ColorInterface $color): int
|
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();
|
$r = $color->channel(Red::class)->value();
|
||||||
$g = $color->channel(Green::class)->value();
|
$g = $color->channel(Green::class)->value();
|
||||||
$b = $color->channel(Blue::class)->value();
|
$b = $color->channel(Blue::class)->value();
|
||||||
|
Reference in New Issue
Block a user