- Convert image format to full-color when forcing large-pixel area
    lossless image formats to JPEG
This commit is contained in:
Marshall T. Vandegrift 2009-01-19 21:32:03 -05:00
parent d321b77930
commit 48340fe6ef

View File

@ -364,7 +364,11 @@ class MobiWriter(object):
if image.format not in ('JPEG', 'GIF'):
width, height = image.size
area = width * height
format = 'GIF' if area <= 40000 else 'JPEG'
if area <= 40000:
format = 'GIF'
else:
image = image.convert('RGBA')
format = 'JPEG'
changed = True
if dimen is not None:
image.thumbnail(dimen, Image.ANTIALIAS)