Merge pull request #31 from leewp14/patch-2

Update file_util.py for support PNG compatible.
This commit is contained in:
codezjx 2018-09-27 12:47:04 +08:00 committed by GitHub
commit 0bc5738bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -14,6 +14,8 @@ 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]:
img.thumbnail(max_size, Image.ANTIALIAS)
if (img.format == 'PNG'):
img = img.convert('RGB')
img.save(file_path, quality=quality)