From cc6b7e41bcb247faded6cfb5585ebf32ebaab315 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 10 Nov 2014 20:44:32 +0100 Subject: [PATCH] Fixed generating thumbnails of GIF images --- src/Services/ImageManipulation/ImagickImageManipulator.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Services/ImageManipulation/ImagickImageManipulator.php b/src/Services/ImageManipulation/ImagickImageManipulator.php index c6fee9d8..16fcf09a 100644 --- a/src/Services/ImageManipulation/ImagickImageManipulator.php +++ b/src/Services/ImageManipulation/ImagickImageManipulator.php @@ -44,8 +44,11 @@ class ImagickImageManipulator implements IImageManipulator switch ($format) { case self::FORMAT_JPEG: - $imageResource->setImageBackgroundColor('white'); - $imageResource = $imageResource->flattenImages(); + $matte = new \Imagick(); + $matte->newImage($imageResource->getImageWidth(), $imageResource->getImageHeight(), 'white'); + $matte->compositeimage($imageResource, \Imagick::COMPOSITE_OVER, 0, 0); + $imageResource->destroy(); + $imageResource = $matte; $imageResource->setImageFormat('jpeg'); break;