Skip to content

Commit

Permalink
Fix decoding error with Imagick driver
Browse files Browse the repository at this point in the history
See: #1261
  • Loading branch information
olivervogel committed Jan 10, 2024
1 parent f8c6f31 commit 1e4afd5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Drivers/Imagick/Decoders/BinaryImageDecoder.php
Original file line number Diff line number Diff line change
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; could be an imagemagick bug.
if ($imagick->getImageFormat() != 'JPEG') {
$imagick = $imagick->coalesceImages();
}

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

0 comments on commit 1e4afd5

Please sign in to comment.