diff --git a/src/Drivers/Gd/Cloner.php b/src/Drivers/Gd/Cloner.php index d29d9add..8723006a 100644 --- a/src/Drivers/Gd/Cloner.php +++ b/src/Drivers/Gd/Cloner.php @@ -5,6 +5,7 @@ namespace Intervention\Image\Drivers\Gd; use GdImage; +use Intervention\Image\Colors\Rgb\Channels\Alpha; use Intervention\Image\Colors\Rgb\Color; use Intervention\Image\Exceptions\ColorException; use Intervention\Image\Geometry\Rectangle; @@ -67,7 +68,9 @@ public static function cloneEmpty( imagealphablending($clone, true); imagesavealpha($clone, true); - if ($background->isClear()) { + // set background image as transparent if alpha channel value if color is below .5 + // comes into effect when the end format only supports binary transparency (like GIF) + if ($background->channel(Alpha::class)->value() < 128) { imagecolortransparent($clone, $processor->colorToNative($background)); }