Merge pull request #85 from seebye/limit-resolution-of-stored-images

loading images: convert L,P mode PNGs to RGBA PNGs
pull/90/head
seebye 4 years ago committed by GitHub
commit fba87ea81b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,6 +43,14 @@ def load_image(path, upper_bound_size):
image.load()
if (image.format == 'PNG'
and image.mode in ('L', 'P')
and 'transparency' in image.info):
# Prevent pillow to print the warning
# 'Palette images with Transparency expressed in bytes should be
# converted to RGBA images'
image = image.convert('RGBA')
if image.mode == 'RGBA':
mask = image.split()[INDEX_ALPHA_CHANNEL]

Loading…
Cancel
Save