diff --git a/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php b/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php index e5db1418..0044ee47 100644 --- a/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php +++ b/src/Drivers/Imagick/Decoders/BinaryImageDecoder.php @@ -29,7 +29,12 @@ class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface 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()) {