From 48340fe6eff473093ea88e0a50ea53acc7b92f55 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Mon, 19 Jan 2009 21:32:03 -0500 Subject: [PATCH] Fix #1654: - Convert image format to full-color when forcing large-pixel area lossless image formats to JPEG --- src/calibre/ebooks/mobi/writer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/writer.py b/src/calibre/ebooks/mobi/writer.py index 4fb080801e..306f097c90 100644 --- a/src/calibre/ebooks/mobi/writer.py +++ b/src/calibre/ebooks/mobi/writer.py @@ -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)