This is just a simple EXE wrapped around the GDI+ Metafile class. I needed to get image data out of some .WMF files and maybe you do too.
You can download a Windows binary or build from source as shown below.
> wmf2png.exe
Usage:
wmf2png.exe INPUTFILE.WMF OUTPUTFILE.PNG
This only works on Windows and is simply a wrapper around the EXE, but it's useful if you need to perform the conversion in Node.js (exporting records from a legacy database, etc):
const
{readFileSync, writeFileSync} = require("fs"),
wmf2png = require("./wmf2png"),
input = readFileSync("./somefile.wmf");
// `input` must be a Buffer containing the WMF contents
wmf2png(input, (error, output) => {
if (error) {
throw error;
}
// `output` is a new buffer with the PNG image data
writeFileSync("./sig.png", output);
});
If you're familiar with Visual Studio then you probably don't NEED CMake but it's convienent for me:
> mkdir build
> cd build
> cmake ..
> wmf2png.sln