EMF File Documentation
Summary
An EMF (Enhanced Metafile) file is a Windows vector image that records GDI drawing commands (lines, curves, text, fills) rather than pixels, so it scales cleanly. Introduced with Windows NT 3.1 in 1993, its MIME type is image/emf. It is used mainly by Microsoft Office and often appears as image001.emf inside Word/PowerPoint files or emails. Open it free in IrfanView, LibreOffice Draw, or Inkscape; convert to PNG or SVG to use it elsewhere. An .emz is just an EMF compressed with GZIP.
Technical details
| Feature | Value |
|---|---|
| Full name | Enhanced Metafile |
| File extension | .emf |
| MIME type | image/emf (also image/x-emf) |
| Format type | Windows GDI vector image (recorded drawing commands) |
| Developer | Microsoft |
| Introduced | 1993 (Windows NT 3.1) |
| Specification | MS-EMF (Microsoft Open Specifications) |
| Open standard | Partial — publicly documented, Microsoft-controlled |
| Byte order | Little-endian |
| First record | EMR_HEADER (record type 1) at offset 0 |
| Signature | DWORD 01 00 00 00 at offset 0; “ EMF” (20 45 4D 46) at offset 40 |
| Predecessor | WMF (16-bit Windows Metafile) |
| Compressed variant | .emz (EMF + GZIP) |
| Can embed | Raster bitmaps (via StretchDIBits/BitBlt records) |
| Common source | Office paste/export, Visio, Windows print spool, clipart |
| Related extensions | .emz, .wmf, .wmz, .svg, .eps |
| Free tools | IrfanView, XnView, LibreOffice Draw, Inkscape |
| Spec URL | learn.microsoft.com (MS-EMF) |
What is an EMF file?
EMF stands for Enhanced Metafile, Microsoft's vector graphics format, introduced with Windows NT 3.1 in 1993 as the 32-bit successor to the older 16-bit WMF (Windows Metafile). It is documented in Microsoft's open MS-EMF specification. Rather than storing a grid of pixels, an EMF file records a sequence of GDI (Graphics Device Interface) drawing commands — move and line, curves, polygons, text with fonts, fills, and coordinate transforms — so the image is usually a scalable vector drawing: a diagram, chart, logo, or piece of clipart. EMF records can also carry embedded raster bitmaps, so some EMF files are effectively pixel images in a vector wrapper.
Most people meet EMF through Microsoft Office. Two situations dominate. First, a graphic named image001.emf arrives as an email attachment or sits inside a document, and a non-Microsoft viewer cannot display it. Second, you unzip a .docx or .pptx (both are ZIP packages) and find .emf files in the word/media/ or ppt/media/ folder. EMF is also the format Windows uses internally to spool a page to a printer, which is where the format originally earned its place in the operating system.
The EMR_HEADER record: bounds, frame and the signature
An EMF file is a stream of fixed-structure records, and the very first record is always EMR_HEADER. It defines the coordinate space and the file-level bookkeeping for everything that follows. Its opening fields sit at known offsets:
offset 0 : iType = 0x00000001 EMR_HEADER record type
offset 4 : nSize size of this header record
offset 8 : rclBounds (16 bytes) bounding rectangle, device units
offset 24 : rclFrame (16 bytes) frame rectangle, .01 mm units
offset 40 : dSignature = 0x464D4520 ASCII " EMF"
offset 44 : nVersion metafile version (0x00010000)
offset 48 : nBytes total size of the metafile
offset 52 : nRecords number of records in the file
offset 56 : nHandles size of the GDI object handle table
The iType value of 1 marks the record as the header, and the four bytes at offset 40 spell the ASCII string EMF (with a leading space) — the reliable way to identify the format. rclBounds gives the drawing's extent in device pixels while rclFrame gives it in hundredths of a millimetre, which together let a renderer scale the picture to any output device. nBytes and nRecords tell a reader exactly how much data and how many records to expect, and nHandles sizes the table that will hold the pens, brushes, and fonts created during playback.
The record stream: playing back GDI commands
After the header, EMF is a sequence of records that a reader “plays back” into a device context, exactly as if the original program were redrawing the picture. Every record shares the same two leading fields: a 32-bit iType naming the operation and a 32-bit nSize giving the record's length, so an unknown record can be skipped by advancing nSize bytes. The records fall into a few families:
- Object creation —
EMR_CREATEPEN,EMR_CREATEBRUSHINDIRECT,EMR_EXTCREATEFONTINDIRECTWbuild GDI objects and put them in the handle table. - Object selection —
EMR_SELECTOBJECTmakes a created pen, brush, or font current. - Drawing —
EMR_MOVETOEX,EMR_LINETO,EMR_POLYGON16,EMR_EXTTEXTOUTWemit the actual geometry and text. - State —
EMR_SETWORLDTRANSFORMandEMR_SAVEDC/EMR_RESTOREDCchange the coordinate transform and save/restore drawing state. - Raster —
EMR_STRETCHDIBITSandEMR_BITBLTblit an embedded bitmap into the picture.
The stream always ends with EMR_EOF, the end-of-metafile record. Because the picture is a program of drawing calls rather than a bitmap, its fidelity on a non-Windows system depends on how faithfully that system reimplements GDI semantics, which is why cross-platform tools sometimes render EMF text or transforms slightly differently.
EMF versus WMF and EMZ
EMF replaced WMF, the 16-bit Windows Metafile from the Windows 3.x era. WMF records use 16-bit coordinates and a smaller command set tied to the old GDI, whereas EMF uses 32-bit coordinates, adds many records (world transforms, wide-character text, richer paths), and is device-independent. Converting EMF to WMF is therefore a downgrade that can lose features, and is rarely wanted; the reverse (WMF to EMF) is the natural direction.
An .emz file is simply an EMF compressed with GZIP — the relationship is identical to SVGZ versus SVG. Decompressing an .emz with 7-Zip or gunzip yields a plain .emf byte-for-byte, and both hold the same vector drawing. That is why an EMZ magic number is the GZIP 1F 8B rather than the EMF header, and why any EMF tool works on an EMZ once it is decompressed.
Converting EMF to PNG or SVG
The two conversions that matter are to a raster image for the web and to another vector format for editing. For PNG (vector to raster), the quickest Windows route is to open the EMF in IrfanView or XnView and Save As, or to insert it into Word/PowerPoint, right-click, and choose Save as Picture; anywhere, LibreOffice Draw and Inkscape export PNG. Because this rasterises the drawing, pick a resolution high enough for its final use. For SVG (vector to vector), open the EMF in Inkscape or LibreOffice Draw and export SVG; this keeps the paths scalable, though some complex GDI text or transform records may render slightly differently. Prefer PNG over JPG for diagrams and line art, since JPG's lossy compression smears sharp edges.
On macOS and Linux there is no built-in EMF support, so LibreOffice Draw and Inkscape (each with its own EMF interpreter) are the reliable free openers and converters.
References
- Microsoft Open Specifications — MS-EMF: Enhanced Metafile Format
- Microsoft Learn — Metafiles (GDI+)
- The Document Foundation — LibreOffice Draw (opens and converts EMF)
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.