diff --git a/src/calibre/ebooks/docx/cleanup.py b/src/calibre/ebooks/docx/cleanup.py index bb421afc89..cea90f137f 100644 --- a/src/calibre/ebooks/docx/cleanup.py +++ b/src/calibre/ebooks/docx/cleanup.py @@ -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)