1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-20 20:51:20 +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\Gif\Decoder as GifDecoder;
use Intervention\Gif\Splitter as GifSplitter;
use Intervention\Image\Drivers\Gd\Cloner;
use Intervention\Image\Drivers\Gd\Core;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\Exceptions\DecoderException;
@@ -39,15 +38,16 @@ class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface
throw new DecoderException('Unable to decode input');
}
// clone image to normalize transparency to #ffffff00
$normalized = Cloner::clone($gd);
imagedestroy($gd);
if (!imageistruecolor($gd)) {
imagepalettetotruecolor($gd);
}
imagesavealpha($gd, true);
// build image instance
$image = new Image(
new Driver(),
new Core([
new Frame($normalized)
new Frame($gd)
]),
$this->extractExifData($input)
);