pydocx icon indicating copy to clipboard operation
pydocx copied to clipboard

Doesn't support WMF images

Open jhubert opened this issue 10 years ago • 12 comments

WMF image results in a blank data URI

Sample file here: https://dl.dropboxusercontent.com/u/7000934/PyDocX/WMF%20Image%20Test.docx

jhubert avatar Jun 30 '15 01:06 jhubert

@jhubert I believe that your problem is that wmf/emf images cannot be rendered by web browsers. The pydocx library can parse wmf images as another file formats. If this is your problem you should convert this images to a format that browsers can handle (png, jpg, svg).

IuryAlves avatar Jun 30 '15 19:06 IuryAlves

@IuryAlves You're probably right. My impression of the HTML Exporter is that it would export something useful in HTML. Converting WMF files to something useable in HTML seems like it should be the default behavior to me. I suppose I could just write another mixin.

jhubert avatar Jul 18 '15 19:07 jhubert

@jhubert I search a lot for libraries that can convert wmf to png. The best that i found is wand. But the conversion is a slow proccess.

IuryAlves avatar Jul 19 '15 16:07 IuryAlves

@jhubert Have you done something with this issue? I am about to start a project to convert wmf to png , or svg using imagemagick

IuryAlves avatar Sep 09 '15 22:09 IuryAlves

I haven't. It wasn't very high priority but would still be useful.

On Sep 9, 2015, 3:18 PM -0700, [email protected], wrote:

@jhubert(https://github.com/jhubert)Have you done something with this problem. I am about to start a project to convert wmf to png images, or svg using imagemagick

— Reply to this email directly orview it on GitHub(https://github.com/CenterForOpenScience/pydocx/issues/166#issuecomment-139060973).

jhubert avatar Sep 09 '15 22:09 jhubert

@jhubert Ok. I will start to implement this.

IuryAlves avatar Sep 09 '15 22:09 IuryAlves

:+1:

jhubert avatar Sep 15 '15 03:09 jhubert

@jhubert I want to discuss a solution for this problem with you. I search for python libraries that can convert from wmf/emf to png, but i didn't have success. The solution that i found is to use unoconv. The problems with this solution is that unoconv needs libreoffice to run, and also the unoconv is not importable as a python module, instead, i had to call the unoconv as a subprocess.

OBS: libmagick is another possible solution, but it can only convert from wmf to png

IuryAlves avatar Oct 05 '15 16:10 IuryAlves

I've dealt with unoconv in the past, and I would recommend avoiding it. It's slow and requires a fairly heavy-weight libreoffice process to start up. It's also a pain to get installed consistently.

OBS: libmagick is another possible solution, but it can only convert from wmf to png

Could something then be used to convert that png to the desired format? I think a double convert would still be cleaner than unoconv.

winhamwr avatar Oct 07 '15 15:10 winhamwr

Getting to would be good enough for me.

On Wed, Oct 7, 2015 at 10:46 AM, Wes Winham [email protected] wrote:

I've dealt with unoconv in the past, and I would recommend avoiding it. It's slow and requires a fairly heavy-weight libreoffice process to start up. It's also a pain to get installed consistently.

OBS: libmagick is another possible solution, but it can only convert from wmf to png

Could something then be used to convert that png to the desired format? I think a double convert would still be cleaner than unoconv.

— Reply to this email directly or view it on GitHub https://github.com/CenterForOpenScience/pydocx/issues/166#issuecomment-146239838 .

jhubert avatar Oct 07 '15 15:10 jhubert

@winhamwr some images are in emf format, which libmagick can't convert and also, i search for python wrappers for libmagick and all of them doesn't work correctly with wmf/emf images. Wes Winham, i agree with you, unoconv has issues, but a don't know another alternatives.

@jhubert I will try to release the mixin as far as possible.

IuryAlves avatar Oct 07 '15 16:10 IuryAlves

How to convert WMF to png?

903165495 avatar Oct 10 '19 05:10 903165495