Commit ffae64dd authored by Serge Koval's avatar Serge Koval

Fixed pillow image conversion

parent b0339184
......@@ -465,7 +465,10 @@ class ImageUploadField(FileUploadField):
return image
def _save_image(self, image, path, format='JPEG'):
if image.mode not in ('RGB', 'RGBA'):
# New Pillow versions require RGB format for JPEGs
if format == 'JPEG':
image = image.convert('RGB')
elif image.mode not in ('RGB', 'RGBA'):
image = image.convert('RGBA')
with open(path, 'wb') as fp:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment