Skip to content

Commit

Permalink
Remove normalizing in GD's BinaryImageDecoder
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Jan 6, 2024
1 parent 8b409f3 commit 38fa2df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Drivers/Gd/Decoders/BinaryImageDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
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;
Expand Down Expand Up @@ -39,15 +38,16 @@ private function decodeString(string $input): ImageInterface
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)
);
Expand Down

0 comments on commit 38fa2df

Please sign in to comment.