Open MWMWM opened 1 year ago
I'm having the same issue. Based on some investigation the bug seems to happen only for some images and is coming from the python-docx
package. For example, I don't get the bug if I use this image from the python-docx test images
What fixed it in my case is opening and saving the image with PIL
:
from PIL import Image
f = Image.open('sample_image.jpeg')
f.save('new_sample_image.jpeg')
f.close()
myimage = InlineImage(tpl, image_descriptor="new_sample_image.jpeg", width=Mm(100), height=Mm(100))
context["myimage"] = myimage
this might not work in all cases, so I'm still hoping there's a better fix here
@sanjass so maybe it's a different case - image from this image from the python-docx test images is not working in my case (the same image has to be present in template and added as an InlineImage)
did anyone noticed that the Inline image class is changing the docx template format? Seems like that the final format is letter rather than e.g A4
Describe the bug
I have a template that is supposed to render an inline image and a sub template containing an image but it fails (rendering only with a sub template or an inline image works great, rendering an inline image and a sub template NOT containing an image is also working)
To Reproduce
template1.docx template2.docx
Current behavior
The following error happens
Expected behavior
Template is rendered