mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #614
This commit is contained in:
parent
e48dcbe7c2
commit
46a827567a
@ -1724,6 +1724,7 @@ def process_file(path, options, logger=None):
|
||||
width, height = pwidth, int(corrf*height)
|
||||
|
||||
scaled, width, height = fit_image(width, height, pwidth, pheight)
|
||||
try:
|
||||
cim = im.resize((width, height), PILImage.BICUBIC).convert('RGB') if \
|
||||
scaled else im
|
||||
cf = PersistentTemporaryFile(prefix=__appname__+"_", suffix=".jpg")
|
||||
@ -1736,6 +1737,9 @@ def process_file(path, options, logger=None):
|
||||
tf.close()
|
||||
tim.save(tf.name)
|
||||
tpath = tf.name
|
||||
except IOError, err: # PIL sometimes fails, for example on interlaced PNG files
|
||||
logger.warn(_('Could not read cover image: %s'), err)
|
||||
options.cover = None
|
||||
else:
|
||||
raise ConversionError, _('Cannot read from: %s')% (options.cover,)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user