EMF — Enhanced Metafile: The 32-bit WMF Successor and Universal Windows Print Buffer
EMF (Enhanced Metafile, or Enhanced Windows Metafile) is a vector format developed by Microsoft for Windows NT 3.1 in July 1993. It is a direct successor to 16-bit WMF: the same principles of recording a sequence of GDI calls, but with 32-bit coordinates, Bezier curve support, transparency, gradients, and Unicode. EMF is the standard file format of the Windows spooler: when you print a document from any application, the operating system creates an intermediate EMF file, and then the printer driver converts it into device commands. Any program capable of writing GDI implicitly knows how to write EMF. Opening EMF is a task for LibreOffice, Inkscape, Word, IrfanView, MS Visio, GIMP. An OpenStreetMap map in EMF can be pasted into modern Word, scaled to poster size in Visio, or printed on an A0 plotter via the standard Windows driver.
History: Windows NT 3.1, 32-bit architecture, EMF+
In July 1993 Microsoft released Windows NT 3.1 — the first fully 32-bit version of the Windows operating system. All base formats were updated along with the system: EMF appeared as the extended 32-bit variant of WMF. The formal record specification is called EMR (Enhanced Metafile Record), numbering starts with EMR_HEADER (type 1) and continues to hundreds of records in modern versions.
Key differences between EMF and WMF. First, 32-bit signed coordinates instead of 16-bit — the range grew from ±32767 to ±2.1 billion. This removes practically any scale limitation. Second, cubic Bezier curves were added via the EMR_POLYBEZIER record. Third, real transparency support via alpha channel. Fourth, fonts are recorded in Unicode (UTF-16), which permits Cyrillic, ideographs, and Arabic script without codepage substitution.
In 2002 with Windows XP, EMF+ appeared — an EMF extension adding the object-oriented rendering model from GDI+. EMF+ is backward compatible with EMF: a file contains both old EMR records (as fallback) and new GDI+ records (as enhanced). Modern Office programs use EMF+ by default when copying vector graphics to the clipboard.
Unlike WMF, EMF never had a Placeable Metafile analog — the EMR_HEADER record initially contains all needed metadata: bounding box, physical size in HIMETRIC units, format version. This simplifies interop: any program reading EMF immediately knows scale.
What's inside an EMF file
EMF is a binary format starting with an EMR_HEADER record of at least 88 bytes:
4 bytes: record type (=1 for EMR_HEADER)
4 bytes: record size in bytes
16 bytes: rclBounds (bbox in device units)
16 bytes: rclFrame (bbox in .01 mm units)
4 bytes: dSignature (' EMF' = 0x464D4520)
4 bytes: nVersion
4 bytes: nBytes (total file size)
4 bytes: nRecords
2 bytes: nHandles
2 bytes: reserved
4 bytes: nDescription
4 bytes: offDescription
4 bytes: nPalEntries
8 bytes: szlDevice (referent device size in pixels)
8 bytes: szlMillimeters (device size in .01 mm)
The signature ' EMF' (space in front) is the main format marker. After the header follows a sequence of EMR records: EMR_SELECTOBJECT, EMR_CREATEPEN, EMR_LINETO, EMR_RECTANGLE, EMR_POLYBEZIER, EMR_EXTTEXTOUTW (Unicode text output), ending with EMR_EOF.
EMF coordinates are 32-bit signed integers in device units. Mapping mode (MM_TEXT, MM_LOMETRIC, MM_HIMETRIC, MM_TWIPS, MM_ISOTROPIC, MM_ANISOTROPIC) sets the relation between device units and physical sizes. A 1 km × 1 km district map at MM_HIMETRIC (0.01 mm) is encoded with coordinates 0..100000 — entirely reasonable for a 32-bit format.
Objects in EMF are the same as in WMF: pens, brushes, fonts, regions, palettes. Created via EMR_CREATEPEN, EMR_CREATEBRUSHINDIRECT, EMR_EXTCREATEFONTINDIRECTW, switched via EMR_SELECTOBJECT. Additional to WMF: EMR_GRADIENTFILL (gradient fill) and EMR_ALPHABLEND (alpha blending).
When EMF is better than WMF
Modern Office. Microsoft Word 2007+, Excel, PowerPoint, Visio default to pasting vector graphics as EMF, not WMF. On a modern Windows machine the result of pasting from osm2cdr (via Inkscape SVG conversion) looks best in EMF: curves smooth, transparency works, fonts transmit in Unicode.
Large maps. 32-bit coordinates remove the scene size limit. An entire Moscow district map or Brest oblast can be saved without renormalization to file coordinate space — meaning that under scaling in Visio or under Word with text-wrap, detail survives.
Multilingual labels. EMF records font names in Unicode, and the text itself in EMR_EXTTEXTOUTW comes through as UTF-16 strings. This is critical for maps with Cyrillic or Chinese labels. Old WMF would have required a codepage (CP-1251 for Russian), leading to garble on a computer with different locale.
Printing on A0/A1 plotters. Windows drivers for modern HP DesignJet, Canon imagePROGRAF, Epson SureColor accept EMF as an intermediate spool format. A large district map sent to print through any program reaches the plotter via EMF — and quality remains vector.
Who needs EMF: four scenarios
Corporate Office 2010-2024 user. The widest case. Any copy of vector graphics from an Excel chart or Visio diagram into Word is EMF under the hood. If a district map is needed in a report or presentation, EMF guarantees crispness when printing and scaling on a projector.
Design engineer with CAD pipeline. SolidWorks, AutoCAD, Inventor can export drawings to EMF for later insertion into technical documentation. A terrain map next to an engineering drawing preserves a unified vector style, doesn't pixelate when scaled to A2.
Print designer. For booklets and brochures on a Windows machine EMF is an acceptable intermediate between Inkscape/Illustrator and QuarkXPress/InDesign. Textures and gradients transfer more accurately than via WMF.
Reports system administrator. PowerShell scripts often generate reports with embedded graphics; exports from Crystal Reports, SSRS, or Power BI to Word/PDF pass through EMF spool. Understanding the format helps diagnose visual bugs in final documents.
Software for EMF: seven programs
LibreOffice (Draw, Writer). Free. Most convenient path for Linux and macOS users. Supports EMF and EMF+, converts to SVG/PDF without losses. libreoffice.org
Microsoft Word, Excel, PowerPoint. Paid. EMF is the native paste format. Excel when copying cells with conditional formatting creates EMF in the clipboard; Word when saving to .docx packs EMF inside the archive. microsoft.com/office
Microsoft Visio. Paid. The main professional tool for technical diagrams on Windows. EMF import via File → Open or drag-and-drop. After import EMF objects become editable: you can recolor roads, add labels to buildings. microsoft.com/visio
Inkscape. Free. Imports EMF via File → Open. Support is somewhat weaker than LibreOffice, but basic maps open correctly. Export to EMF via File → Save As. inkscape.org
CorelDRAW. Paid. Opens EMF, saves as CDR. Import quality on par with Inkscape. coreldraw.com
IrfanView with plugin. Free for personal use. Simple viewer, convenient for quick file check before pasting into a document. irfanview.com
Inkscape extension for batch. Inkscape 1.3 ships with the "Save Selected as EMF" extension — useful when you need to export only one map layer (for example, Buildings only) for later insertion into a technical drawing.
EMF vs EMF+ — which to choose
| Parameter | EMF (classic) | EMF+ |
|---|---|---|
| Released | 1993, Windows NT | 2002, Windows XP / GDI+ |
| Transparency | Basic (ALPHABLEND) | Full alpha channel |
| Curves | Bezier via POLYBEZIER | Bezier + B-spline |
| Legacy support | All Windows NT+ | Windows XP+ |
| Size for typical map | 200–800 KB | 250–900 KB |
| LibreOffice support | Yes | Yes |
| Inkscape support | Yes | Partial |
Choose EMF+ when you need modern gradients, transparent underlays, smooth shadows. Choose classic EMF when maximum compatibility with old programs and printer drivers matters most.
Pitfalls and tips
EMF+ vs EMF compatibility. Although EMF+ is backward compatible with EMF, not all programs parse the extended records correctly. Older Inkscape may ignore GDI+ records and show only the fallback picture. If the map is planned for editing in Inkscape — export to classic EMF, not EMF+.
Fallback on non-Windows platforms. Linux and macOS open EMF via LibreOffice and Inkscape, but visual fidelity depends on the quality of GDI emulation in the libemf library. Complex gradients, transparency hypatheses may render slightly differently. For guaranteed cross-OS viewing use SVG or PDF.
File size. A medium-sized district map in EMF is 200–800 KB. A fully detailed central Moscow can grow to 5–10 MB. For web publication this is large; convert to SVG or PDF.
Fonts. As in WMF, EMF records the font name (but in Unicode), not the font file itself. On a machine without the needed font, Windows substitutes a fallback. Solution: use standard Windows fonts, or convert text to curves before export.
Coordinate space. Although 32-bit coordinates remove the practical limit, exceeding HIMETRIC range 0..2147483647 (approximately 21.4 km at physical scale) under MM_HIMETRIC mapping mode will overflow. For gigantic maps switch to MM_ISOTROPIC and compress the coordinate grid.
EMR_EXTTEXTOUTW encoding. Text in Unicode UTF-16 little-endian. If your EMF file parser (e.g. a custom script) reads the stream as UTF-8 — Cyrillic will mangle. Use proven libraries: libemf for C/C++, pyemf for Python.
How to get a map as EMF via osm2cdr.ru
Step 1: on osm2cdr.ru choose SVG format. Step 2: draw the needed area — a quarter of 200–500 m is fine for a Word document, 1–2 km for a presentation. Step 3: download the SVG. Step 4: open in LibreOffice Draw (best Office compatibility) or Inkscape. Step 5: File → Export → choose Enhanced Metafile (.emf). Step 6: paste into Word via Insert → Picture → From File.
Alternative for batch processing: ImageMagick with librsvg magick input.svg input.emf (available from ImageMagick 7.0). Useful for scripted multi-map builds.
Related formats and resources
- WMF — the 16-bit ancestor of EMF
- SVG — open W3C web standard
- DXF — CAD format
- PDF — universal print format
- PDF landing page
- SVG landing page
Sources
- Microsoft, [MS-EMF] Enhanced Metafile Format specification — learn.microsoft.com/openspecs/windows_protocols/ms-emf
- Microsoft, [MS-EMFPLUS] EMF+ specification — learn.microsoft.com/openspecs/windows_protocols/ms-emfplus
- Wikipedia, Windows Metafile (EMF section) — en.wikipedia.org/wiki/Windows_Metafile
- MSDN, GDI Reference — learn.microsoft.com/windows/win32/gdi
- libemf, open-source EMF library — libemf.sourceforge.net