https://github.com/travispaul/wmf2png
Convert a Windows Metafile (WMF) to a PNG.
https://github.com/travispaul/wmf2png
converter windows wmf
Last synced: over 1 year ago
JSON representation
Convert a Windows Metafile (WMF) to a PNG.
- Host: GitHub
- URL: https://github.com/travispaul/wmf2png
- Owner: travispaul
- License: bsd-2-clause
- Created: 2018-01-23T07:46:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-06T09:25:51.000Z (over 8 years ago)
- Last Synced: 2025-04-06T12:04:09.116Z (over 1 year ago)
- Topics: converter, windows, wmf
- Language: C++
- Size: 17.6 KB
- Stars: 5
- Watchers: 0
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wmf2png
This is just a simple EXE wrapped around the [GDI+ Metafile class](https://msdn.microsoft.com/en-us/library/windows/desktop/ms536391(v=vs.85).aspx). I needed to get image data out of some [.WMF files](https://msdn.microsoft.com/en-us/library/cc250370.aspx) and maybe you do too.
You can [download a Windows binary](https://us-east.manta.joyent.com/tpaul/public/windows/wmf2png.zip) or build from source as shown below.
## EXE Usage
```
> wmf2png.exe
Usage:
wmf2png.exe INPUTFILE.WMF OUTPUTFILE.PNG
```
## Node.js Usage
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);
});
```
## Build from source
If you're familiar with Visual Studio then you probably don't **NEED** [CMake](https://cmake.org/download/) but it's convienent for me:
```
> mkdir build
> cd build
> cmake ..
> wmf2png.sln
```