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:
Kovid Goyal 2013-09-13 15:18:10 +05:30
parent 5271d1a2e1
commit 740053ed36

View File

@ -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)