1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-21 13:11:18 +02:00

Remove normalizing in GD's BinaryImageDecoder

This commit is contained in:
Oliver Vogel
2024-01-06 14:24:33 +01:00
parent 8b409f3870
commit 38fa2df2e3

View File

@@ -9,7 +9,6 @@ use Intervention\Image\Interfaces\DecoderInterface;
use Intervention\Image\Interfaces\ImageInterface; use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Gif\Decoder as GifDecoder; use Intervention\Gif\Decoder as GifDecoder;
use Intervention\Gif\Splitter as GifSplitter; use Intervention\Gif\Splitter as GifSplitter;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Drivers\Gd\Core; use Intervention\Image\Drivers\Gd\Core;
use Intervention\Image\Drivers\Gd\Driver; use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\Exceptions\DecoderException; use Intervention\Image\Exceptions\DecoderException;
@@ -39,15 +38,16 @@ class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface
throw new DecoderException('Unable to decode input'); throw new DecoderException('Unable to decode input');
} }
// clone image to normalize transparency to #ffffff00 if (!imageistruecolor($gd)) {
$normalized = Cloner::clone($gd); imagepalettetotruecolor($gd);
imagedestroy($gd); }
imagesavealpha($gd, true);
// build image instance // build image instance
$image = new Image( $image = new Image(
new Driver(), new Driver(),
new Core([ new Core([
new Frame($normalized) new Frame($gd)
]), ]),
$this->extractExifData($input) $this->extractExifData($input)
); );