Skip to content

Commit

Permalink
Merge pull request #1262 from Intervention/bugfix/coalesce-images-dec…
Browse files Browse the repository at this point in the history
…oding-error

Fix decoding error with Imagick driver
  • Loading branch information
olivervogel committed Jan 14, 2024
2 parents 9531e0e + f3cef58 commit e04c51b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Drivers/Imagick/Decoders/BinaryImageDecoder.php
Expand Up @@ -29,7 +29,12 @@ public function decode(mixed $input): ImageInterface|ColorInterface
throw new DecoderException('Unable to decode input');
}

$imagick = $imagick->coalesceImages();
// For some JPEG formats, the "coalesceImages()" call leads to an image
// completely filled with background color. The logic behind this is
// incomprehensible for me; could be an imagick bug.
if ($imagick->getImageFormat() != 'JPEG') {
$imagick = $imagick->coalesceImages();
}

// fix image orientation
switch ($imagick->getImageOrientation()) {
Expand Down

0 comments on commit e04c51b

Please sign in to comment.