viewhack

Open an EMF or WMF picture without Office

Someone sent you an .emf or .wmf, or you pulled one out of a Word, PowerPoint or Visio file, and nothing on your phone or Mac shows it. Drop it here: it is drawn in this tab, and you can save it as a PNG (at its own size or twice that) or as an SVG. Below the picture: its size in millimetres, its DPI, the fonts and text in it, every embedded bitmap (each savable) and a count of every record.

The file is read by this tab on your device and is not uploaded, so a company logo or an unreleased chart goes nowhere.

What it shows

Where these files come from

EMF (Enhanced Metafile, 1993 on)
The vector format of Windows since Windows NT 3.1 and 95: 32-bit coordinates, a header with the picture’s size in hundredths of a millimetre, and records of a 4-byte type and a 4-byte size. Excel charts and Visio shapes copied to the clipboard become EMF, and Word and PowerPoint store pasted vector pictures as word/media/image1.emf or ppt/media/image3.emf inside the .docx or .pptx (rename a copy to .zip to get at them).
WMF (Windows Metafile, Windows 3.x)
The 16-bit predecessor, still common in clip-art collections and old Office documents. Coordinates are 16-bit; the physical size is only known when the file starts with the 22-byte “placeable” header (key D7 CD C6 9A), which gives a bounding box and how many units make an inch. Without it, a WMF has no size of its own and this page fits it to the screen.
EMZ and WMZ
An EMF or WMF compressed with gzip. Office writes these inside some documents; they are unpacked here in the tab with the vendored fflate library.
EMF+
GDI+ drawing (anti-aliased, with transparency and gradients) stored in comment records inside an EMF. Most EMF+ files are “Dual”: they also carry the plain EMF records for the same picture, which this page draws. An EMF+-only file has no such copy, and the page says so instead of showing an unexplained blank.

How the file is read

Written from Microsoft’s specifications
The reader and renderer were written for this site from the published open specifications [MS-EMF] (Enhanced Metafile Format) and [MS-WMF] (Windows Metafile Format), with the section numbers cited in the code; [MS-EMFPLUS] is used only to recognise EMF+ records. No code from LibreOffice, libwmf, libemf or any other metafile reader is used.
Coordinates
EMF records are mapped through the world transform, the window and viewport and the mapping mode (pixels, 0.1 mm, 0.01 mm, 0.01 inch, 0.001 inch, twips, isotropic or anisotropic) to the reference device, then the header’s frame is fitted to the screen. In a WMF, the window is mapped onto the placeable bounding box, as Office and LibreOffice do.
Tested on
Seven real metafiles from the Apache POI project’s test files (Apache License 2.0), including a Japanese project schedule, an equation, clip art, a flow diagram and two EMF+ Dual files (a scatter plot and an embedded-file icon), plus generated files built record by record from the specifications.

What this cannot do

Other ways to open them

Windows
Paint opens .emf and .wmf (and rasterises them); Word, PowerPoint and Visio insert them as editable pictures.
LibreOffice Draw and Inkscape (free, every platform)
Both import EMF and WMF and can export PDF or SVG. LibreOffice also draws EMF+, so it is the one to try for an EMF+-only file.
macOS and phones
Preview, Photos and the phone galleries do not open metafiles at all, which is when a page like this one helps.