Skip to content

Commit

Permalink
Small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjoes committed Oct 16, 2019
1 parent ffae64d commit b0ac34d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion flask_admin/form/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def _resize(self, image, size):

def _save_image(self, image, path, format='JPEG'):
# New Pillow versions require RGB format for JPEGs
if format == 'JPEG':
if format == 'JPEG' and image.mode != 'RGB':
image = image.convert('RGB')
elif image.mode not in ('RGB', 'RGBA'):
image = image.convert('RGBA')
Expand Down

0 comments on commit b0ac34d

Please sign in to comment.