Introduction
The Enhanced Metafile is the 32-bit successor to the Windows Metafile (WMF). It records calls to the Windows graphics system (GDI) so they can be played back to draw the picture again at any size. It came with the 32-bit versions of Windows in the early 1990s.
EMF is used for clipboard pictures, print spooling and charts and drawings embedded in Office documents. A later extension, EMF+, adds records for GDI+ drawing inside the same file.
Structure
An EMF file is a list of records, all little-endian. Each record starts with a 4-byte
type and a 4-byte size in bytes. The first record is the header (type 1), which gives
the picture's bounds and physical size, the signature 20 45 4D 46
(" EMF") at offset 40, the version, the file size and the number of records. The last
record is end-of-file (type 14).
EMF+ drawing is stored in comment records, so a program that only knows plain EMF can still draw the plain records that usually follow as a fallback.
0Header record type 1, size, bounds, frame, signatureEMFat 40, version, countsvaries…Drawing records type, size, parametersvaries…End-of-file record type 1420 bytes or more
The full layout is in the reference pages: the header record and every record type.
Not described
The header and records pages follow Microsoft’s MS-EMF (revision 18.0).
Known, not yet covered
- Reference: EMF+ records (MS-EMFPLUS) and EMF spool records (MS-EMFSPOOL) are defined by Microsoft but not described; the page says so for EMF+.
- Reference: the public comment records
EMR_COMMENT_WINDOWS_METAFILE,BEGINGROUPandMULTIFORMATShave layouts in MS-EMF that are not yet tabulated. - Reference: the objects
LogPen,LogBrush,LogFont,ExtLogFontW,LogPaletteand region data are named but not laid out, and the remaining MS-EMF enumerations are not listed. - Viewer: there is no EMF plugin yet. A shared reader (
metafile.js) can turn EMF and WMF into SVG for other viewers, but no plugin opens the files themselves.
Links
Software
- LibreOffice – free office suite that opens and exports EMF (Windows, macOS, Linux)
- Inkscape – free vector editor that imports and exports EMF (Windows, macOS, Linux)
- Microsoft Word and PowerPoint – insert EMF pictures into documents (Windows, macOS)
- IrfanView – free image viewer that shows EMF files (Windows)
- XnView MP – image viewer and converter that opens EMF (Windows, macOS, Linux)
Reference
- [MS-EMF]: Enhanced Metafile Format – Microsoft’s published specification
- [MS-EMFPLUS]: Enhanced Metafile Format Plus Extensions – Microsoft’s specification of the EMF+ records