mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
DOCX Input: Do not fail if the firs image is an EMF image
Fixes #1224849 [DOCX to EPUB conversion failed with devide by zero](https://bugs.launchpad.net/calibre/+bug/1224849)
This commit is contained in:
parent
5271d1a2e1
commit
740053ed36
@ -173,7 +173,10 @@ def cleanup_markup(log, root, styles, dest_dir, detect_cover):
|
||||
width, height, fmt = identify(path)
|
||||
except:
|
||||
width, height, fmt = 0, 0, None
|
||||
is_cover = 0.8 <= height/width <= 1.8 and height*width >= 160000
|
||||
try:
|
||||
is_cover = 0.8 <= height/width <= 1.8 and height*width >= 160000
|
||||
except ZeroDivisionError:
|
||||
is_cover = False
|
||||
if is_cover:
|
||||
log.debug('Detected an image that looks like a cover')
|
||||
img.getparent().remove(img)
|
||||
|
Loading…
x
Reference in New Issue
Block a user