Skip to content

Commit b0ac34d

Browse files
committed
Small optimization
1 parent ffae64d commit b0ac34d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flask_admin/form/upload.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def _resize(self, image, size):
466466

467467
def _save_image(self, image, path, format='JPEG'):
468468
# New Pillow versions require RGB format for JPEGs
469-
if format == 'JPEG':
469+
if format == 'JPEG' and image.mode != 'RGB':
470470
image = image.convert('RGB')
471471
elif image.mode not in ('RGB', 'RGBA'):
472472
image = image.convert('RGBA')

0 commit comments

Comments
 (0)