python-pptx icon indicating copy to clipboard operation
python-pptx copied to clipboard

Image.content_type and Image.ext incorrect for EMF files?

Open allefeld opened this issue 1 year ago • 0 comments

I encountered this issue with a particular pptx file, which I was trying to convert using pptx2md which is based on python-pptx.

It appears that if an embedded image file is of type enhanced metafile (file with extension emf in ppt/media), if the PowerPoint file is read with python-pptx, the corresponding Image object has content_type = 'image/x-wmf' and ext = 'wmf'. Within pptx2md, this lead to extracted images being written with the wrong extension, which then cannot be read e.g. by Inkscape. I found that in such cases, filename = 'image.emf', and I contributed a PR https://github.com/ssine/pptx2md/pull/73 which relies on that. That seems hacky though, and a fix in python-pptx would be better.

allefeld avatar Jan 18 '25 18:01 allefeld