Fix #2475 (Calibre 0.5.12 Conversion Error)

This commit is contained in:
Kovid Goyal 2009-05-21 07:05:11 -07:00
parent 4b457c1486
commit a334000e70

View File

@ -650,12 +650,13 @@ class MobiReader(object):
image_index += 1 image_index += 1
try: try:
im = PILImage.open(buf) im = PILImage.open(buf)
im = im.convert('RGB')
except IOError: except IOError:
continue continue
path = os.path.join(output_dir, '%05d.jpg'%image_index) path = os.path.join(output_dir, '%05d.jpg'%image_index)
self.image_names.append(os.path.basename(path)) self.image_names.append(os.path.basename(path))
im.convert('RGB').save(open(path, 'wb'), format='JPEG') im.save(open(path, 'wb'), format='JPEG')
def get_metadata(stream): def get_metadata(stream):
mi = MetaInformation(os.path.basename(stream.name), [_('Unknown')]) mi = MetaInformation(os.path.basename(stream.name), [_('Unknown')])