From b36bbcfe0c3442459f7c0cd149d75b20a0351f91 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sat, 11 Nov 2023 09:26:45 +0100 Subject: [PATCH] Fix bug --- src/Drivers/Gd/Factory.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Drivers/Gd/Factory.php b/src/Drivers/Gd/Factory.php index 6c5c9c84..c2aefa9a 100644 --- a/src/Drivers/Gd/Factory.php +++ b/src/Drivers/Gd/Factory.php @@ -3,6 +3,7 @@ namespace Intervention\Image\Drivers\Gd; use Intervention\Image\Collection; +use Intervention\Image\Colors\Rgb\Channels\Alpha; use Intervention\Image\Drivers\Gd\Frame; use Intervention\Image\Drivers\Gd\Image; use Intervention\Image\Drivers\Gd\Traits\CanHandleColors; @@ -71,13 +72,19 @@ class Factory implements FactoryInterface $core = imagecreatetruecolor($width, $height); $color = match (is_null($background)) { - true => imagecolorallocatealpha($core, 0, 0, 0, 127), + true => imagecolorallocatealpha($core, 255, 0, 255, 127), default => imagecolorallocatealpha( $core, $background->channel(Red::class)->value(), $background->channel(Green::class)->value(), $background->channel(Blue::class)->value(), - 127 + $this->convertRange( + $background->channel(Alpha::class)->value(), + 0, + 255, + 127, + 0 + ) ), };