Converting EMF to SVG

This is one of those “in case I ever need to do it again” posts. Converting EMF files to SVG files – sounds like it should be a simple task, translating from one vector format to another. It turned out not to be.

However, in the end:

find . -name '*.emf' -exec unoconv -f svg "{}" \;

successfully converted a nested directory structure full of .emf files to have their .svg equivalents alongside. Oh, and for some reason (I don’t care why) you have to run this first:

unoconv --listener &

The key ingredient was unoconv (thankfully, Debian-packaged as unoconv), which also requires a load of openoffice and/or libreoffice stuff to make it work. There were a load of other possible ways of doing this that didn’t work, which I won’t even go into. Also, don’t even ask why I needed to do this in the first place.

Update: After I’d finished, I realised I also needed EPS. Easy conversion, not so easy command due to various shell-related complications:

find . -name '*.svg' -exec sh -c 'inkscape "{}" --export-eps="`dirname "{}"`/`basename "{}" .svg`.eps"' \;
  1. Bill’s avatar

    Why did you need to do this in the first place?

    Reply

    1. CiaranG’s avatar

      lol, ok, but don’t expect me to answer.

      Reply

  2. Gene Ricky Shaw’s avatar

    Thank you for this! I had to convert a bunch of files that were .emf to .svg so I could use them in inkscape. It was next to impossible to find a way to successfully convert them from the command line until I found this blog. Thank you, you saved me about 3 hours of work manually opening each file in Libreoffice and exporting them.

    Reply