Open
Description
I met ZeroDivisionError when I just try to add one bmp into a Document, code like this:
from docx import *
from docx.shared import *
doc = Document()
doc.add_picture(u"name-that-contains-chinese-and-space.bmp", height=Inches(4.2))
Error raise:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python27\lib\site-packages\python_docx-0.8.5-py2.7.egg\docx\document.py", line 79, in add_picture
return run.add_picture(image_path_or_stream, width, height)
File "D:\Python27\lib\site-package\python_docx-0.8.5-py2.7.egg\docx\text\run.py", line 62, in add_picture
inline = self,part.new_pic_inline(image_path_or_stream, width, height)
File "D:\Python27\lib\site-package\python_docx-0.8.5-py2.7.egg\docx\parts\document.py", line 92, in new_pic_inline
cx, cy = image.scaled_dimensions(width, height)
File "D:\Python27\lib\site-package\python_docx-0.8.5-py2.7.egg\docx\image\image.py", line 154, in scaled_dimensions
scaling_factor = float(height) / float(self.height)
File "D:\Python27\lib\site-package\python_docx-0.8.5-py2.7.egg\docx\image\image.py", line 134, in height
return Inches(self.px_height / self.vert_dpi)
ZeroDivisionError: division by zero
Sorry that I cannot post the original bmp file here, I doubt whether a bug exists.
I also tried add other bmp files, and no error raises.
Currently, I only met the error just on the special bmp file.
I wanna to help, and I'm happy if someone can help.