#45 Bugfix: Convert picture format to RGB in any case.
This commit is contained in:
parent
4102d3ca81
commit
5c572751b7
|
@ -14,8 +14,7 @@ def resize_img(file_path, max_size=(640, 640), quality=90):
|
||||||
|
|
||||||
if img.size[0] > max_size[0] or img.size[1] > max_size[1]:
|
if img.size[0] > max_size[0] or img.size[1] > max_size[1]:
|
||||||
img.thumbnail(max_size, Image.ANTIALIAS)
|
img.thumbnail(max_size, Image.ANTIALIAS)
|
||||||
if img.format == 'PNG':
|
img = img.convert('RGB')
|
||||||
img = img.convert('RGB')
|
|
||||||
img.save(file_path, quality=quality)
|
img.save(file_path, quality=quality)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue