I recently wanted to convert an Windows Enhanced Metafile (EMF) to SVG. I used an open source conversion library called libemf2svg by Carpentier Pierre-Francois (Kakwa).

Here is what I did:

  1. Download and extract the ZIP’ed source code from https://github.com/kakwa/libemf2svg via the green Code button.
  2. Get the dependencies using Homebrew on macOS with brew install cmake libpng fontconfig freetype argp-standalone (or something like this)
  3. Compile to current folder:
    cmake . -DCMAKE_INSTALL_PREFIX=$(PWD)
    make
    chmod +x emf2svg-conv
  4. Run from CLI emf2svg-conv -i <input.emf> -o <output.svg> replacing the input and output file names.

If you want to transport the binary and dependent non-system libraries to a different macOS computer, use my script from when I wanted a Minuscule Lima setup to replace Docker on macOS.

Specifically, the script re-links emf2svg-conf to use libraries in a lib folder relative to the executable path:

  • libemf2svg.1.dylib
  • libfontconfig.1.dylib
  • libfreetype.6.dylib
  • libpng16.16.dylib

This worked for me!