Is there any command line tool available to convert emf to png images?

I tried the convert utility from ImageMagick, but it says

decoder for emf not found

According to this page: http://www.imagemagick.org/script/formats.php

EMF R Microsoft Enhanced Metafile (32-bit) Only available under Microsoft Windows.


| improve this answer | |
  • Care to explain the downvotes? – Jan Aug 18 '18 at 15:39
  • 1
    I did not downvote but it's annoying to have an accepted answer with information that do not help to solve the problem and only partially answer the question when there is two answers that do below. – Pierre.Sassoulas Feb 10 at 15:18

(Found in https://stackoverflow.com/a/28749719)

Use LibreOffice:

libreoffice --headless --convert-to png image.emf
| improve this answer | |

The other answers here did not work for me, but one I found on stakoverflow did

Another way is to use inkscape:

inkscape -e file.png source.emf

See inkscape --help for more export options (area to export, dpi, image resolution, background color etc).

| improve this answer | |

inkscape is a great idea, but unfortunately it does not do a perfect job, for ex. with label positions getting messed in certain cases, as described here: https://gitlab.com/inkscape/inbox/-/issues/2847

So far the only accurate conversion outside of Windows that I've seen is with OpenOffice (headless) or using the unoconv Python script which calls OpenOffice/LibreOffice to do the work. Maybe there's some way to hack together ImageMagick and Mono (libgdi) under Linux but haven't found anything that's done that yet.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.