Site Root : libwmf


I have now handed this project off to the new maintainer, Martin Vermeer, ( libwmf now resides at This page is now archival material.

My wmf operand documentation remains at

libwmf: wmf library

libwmf's homepage is wmf documentation is at

and my email for bugs and whatnot is

libwmf is a library for unix like machines that can convert wmf files into other formats, currently it supports a gd binding to convert to png, and an X one to draw direct to an X window or pixmap.


xwmf draws wmf files on screen (X) use + to zoom in and use - to zoom out wmftopng converts wmf files to png, can use (and i recommend) truetype fonts wmftofig converts wmf files to fig, (new program, needs some work, but very cool)

REQUIREMENTS (how text strings in wmf files are handled)

1) First you must have the xpm libraries installed, this is the default for linux distributions and many others, if you don't have such a system you can get xpm from

2) To compile this code in its entirity you should have the freetype library (, and you should have a range of truetype fonts, typically the ones supplied with windows.

freetype is only required for the gd binding to libwmf, i.e. the wmftopng program, the X bindings, (xwmf) doesn't require the truetype library, but i very much reccomend that you install xfsft, or have a X server able to use ttf fonts.

Without the freetype library wmftopng will compile, but will not be able to display text strings in the output png. If you do have freetype, you still are required to specify the directory that they are in to wmftopng as the third argument to it, the fonts should be the standard ttf fonts supplied with windows, or the font that the text will be rendered in will not be the original font.

3) Without a truetype font server and the standard windows fonts then the X binding might render text is a different font than would appear under windows natively, this is a runtime issue for the xwmf program.

4) In this release libwmf cannot resize bitmaps embedded in wmf files on its own, and attempt to offload them to the netpbm utilities, so you should have these installed, it wont break anything not to have them installed, and this requirement will be removed in a later release.


it should just be a simple matter of

 make install

on some machines you might have to have gnu make installed, if the make fails try gmake instead.

For full functionality you have to have X, freetype and the xpm libraries installed.

If the xpm libraries are not in the standard locations you can use ./configure --with-xpm-dir to point to the xpm dir location e.g.

If the freetype libraries are not in the standard locations you can use ./configure --with-ttf-dir to point to the freetype dir location e.g.

In each case the dir can either be the dir above the include and lib dirs where the component can be found. Or the actual dir where both the lib and include files exist.


Once everything is installed, if you have an app that you wish to compile against libwmf, here is the sample options for the gd binding, to generate png's from wmf. gcc wmftopng.c -lwmf -ldib -lgdwmf -lxgd -lttf -L/usr/X11R6/lib -lX11 -lXpm -lpng -lz -lm

the breakdown is -lwmf -ldib -lgdwmf -lxgd -lttf -lpng -lz -lm ^^^^ ^^^^ ^^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^ the bmp the gd the truetype png library lib handling binding gd library requirements itself code to libwmf lib

-L/usr/X11R6/lib -lX11 -lXpm ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Xpm library, needed as libdib converts dib's to xpm files. (libdib, is for device indepentant bitmaps, i.e bmp files without their full headers)

the include files that are installed that you need are wmfapi.h for all bindings [ + gdwmfapi.h for gd binding ] OR [ + Xwmfapii.h for X binding ]

for the X binding to draw direct to a pixmap/window

gcc xwmf.c -lwmf -ldib -lXwmf -L/usr/X11R6/lib -lX11 -lXpm -lm

all the same except use libXwmf which is the binding for X.

documentation will be included in a later version as to how to wrote your own binding for the wmf library, especially wanted ones are wmf->fig and wmf->eps.

some other info as to the current situation.

this baby currently attempts to convert 16 bit windows metafiles, known as .wmf to something useful.

In its present state it draws the metafile to an X window, and can output a png file.

Its early code, but works so far on...

at least the collection of clipart from msword and msworks for win 3.1

the wordtests dir is a set of wmf files outputted from sample runs of libwv, the png binding doesnt currently do text, but it will once ive merged code from a tcl binding to gd that understands the truetype format.

It doesnt do emf files, i.e 32bit metafile yet, and is surely quite buggy at the moment.

There are a few examples of clipart files in the clipart dir, some pointers to other freely available clipart would be appreciated. the out.wmf file contains examples of all the currently supported wmf functions.

This is a sister project to libwv, to allow that converter to decode wmf files that are embedded in word docs.

the intention is to use it as a library that you can plug in modules for other file formats. I imagine that the most useful ones would be fig and eps, but i want png support first for libwv.

CHANGELOG is the file with the changes and up to date news. read it for updates.


Download Package

Last generated at Sun Feb 7 00:44:56 2016 Caolán McNamara <> Created with WebMake/0.5