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,18 +1724,22 @@ def process_file(path, options, logger=None):
|
|||||||
width, height = pwidth, int(corrf*height)
|
width, height = pwidth, int(corrf*height)
|
||||||
|
|
||||||
scaled, width, height = fit_image(width, height, pwidth, pheight)
|
scaled, width, height = fit_image(width, height, pwidth, pheight)
|
||||||
cim = im.resize((width, height), PILImage.BICUBIC).convert('RGB') if \
|
try:
|
||||||
scaled else im
|
cim = im.resize((width, height), PILImage.BICUBIC).convert('RGB') if \
|
||||||
cf = PersistentTemporaryFile(prefix=__appname__+"_", suffix=".jpg")
|
scaled else im
|
||||||
cf.close()
|
cf = PersistentTemporaryFile(prefix=__appname__+"_", suffix=".jpg")
|
||||||
cim.save(cf.name)
|
cf.close()
|
||||||
options.cover = cf.name
|
cim.save(cf.name)
|
||||||
|
options.cover = cf.name
|
||||||
tim = im.resize((int(0.75*th), th), PILImage.ANTIALIAS).convert('RGB')
|
|
||||||
tf = PersistentTemporaryFile(prefix=__appname__+'_', suffix=".jpg")
|
tim = im.resize((int(0.75*th), th), PILImage.ANTIALIAS).convert('RGB')
|
||||||
tf.close()
|
tf = PersistentTemporaryFile(prefix=__appname__+'_', suffix=".jpg")
|
||||||
tim.save(tf.name)
|
tf.close()
|
||||||
tpath = tf.name
|
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:
|
else:
|
||||||
raise ConversionError, _('Cannot read from: %s')% (options.cover,)
|
raise ConversionError, _('Cannot read from: %s')% (options.cover,)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user