diff --git a/sorl/thumbnail/engines/pil_engine.py b/sorl/thumbnail/engines/pil_engine.py index 5371be42c..e67572976 100644 --- a/sorl/thumbnail/engines/pil_engine.py +++ b/sorl/thumbnail/engines/pil_engine.py @@ -151,6 +151,8 @@ def _colorspace(self, image, colorspace, format): # Pillow JPEG doesn't allow RGBA anymore. It was converted to RGB before. if image.mode == 'RGBA' and format != 'JPEG': return image # RGBA is just RGB + Alpha + if image.mode == 'RGBA' and format == 'JPEG' and image.format != 'JPEG': + return image.convert('RGB') if image.mode == 'LA' or ( image.mode == 'P' and 'transparency' in image.info and format != 'JPEG' ):