Converting WMF (Windows Metafile) images to SVG
I have made Microsoft Office 97 clip art usable on the Web by converting it to SVG. You can download the converted images from the Internet Archive. While more complex images have the occasional glitch, most images look very close to the original or indistinguishable from it. Because it worked reasonably well, I am sharing how I did it.
I performed the conversion on Linux. I found that the best open source converters for Windows Metafiles as of early 2021 target SVG. They are wmf2svg and LibreOffice Draw.
It turns out that you can use LibreOffice Draw from the command line for batch conversion. (Be careful not to have any LibreOffice instances open. It seems to prevent the file from opening in a “headless” instance.) LibreOffice Draw is preferable because it converts complex images with fewer artifacts than wmf2svg. However, LibreOffice Draw does not preserve the canvas size of the original image like wmf2svg. You must crop the image with another SVG tool like Inkscape after conversion. The shell commands you need in order to both convert and crop are:
libreoffice --headless --convert-to svg Popular/tennis.wmf # Inkscape 0.x inkscape --with-gui --verb FitCanvasToDrawing --verb FileSave --verb FileQuit tennis.svg # Inkscape 1.x inkscape --with-gui --verb 'FitCanvasToDrawing;FileSave;FileQuit' tennis.svg
Once your images are converted, you can optimize them for size with SVGO. I did not optimize Office 97 clip art.