Windows metafile

from Wikipedia, the free encyclopedia
Windows metafile
File extension : .wmf, .wmz
MIME type : image / x-wmf
Developed by: Microsoft
Type: Graphic format
Expanded to: Windows Enhanced Metafile


Windows Metafile ( WMF ) is a proprietary Metafile - graphic format the company Microsoft . It was developed for the exchange of graphics across different programs and is used, among other things, in the Windows clipboard . If graphics are saved in WMF format, the files have the three-letter filename extension .wmf . WMF is a 16-bit format that was introduced with Microsoft Windows 3.0 .

WMF is a vector-based file format. This means that sharp edges remain sharp even after any enlargement. In addition, areas can be filled with raster graphics .

The part of the name “Meta” indicates that this format was designed for data exchange via the clipboard .

Inadequacies

In contrast to other vector-based file formats such as PostScript or SVG , WMF does not have the ability to display splines directly. During the conversion, a curved line defined as a spline is therefore broken down into a line with short, straight sections. The length of these sections is based on what is barely recognizable as a combination of straight sections in a typical screen display.

All graphics systems (including PostScript) use internal lines for the curved lines of fonts and for circles and ellipses. At WMF, the lines are also in the file. As a result, when copying via the clipboard and then enlarging it, the steps and corners between the individual route sections appear if the individual lines are too long. After being copied to the clipboard, an i-point may look more like a polygon than a circle. In this way, the potential advantage of a vector-based format is partially lost. Since printers have a much higher resolution than screens, you can see in the printout, even without magnification, that curved lines consist of individual straight sections. This effect occurs surprisingly in particular when the graphics-generating program z. B. has created an OLE object including the WMF preview with sufficient accuracy only for the screen display.

WMF's capabilities would certainly make it possible to produce graphics that are satisfactorily accurate for printing. In particular, the basic freedom of choice of the graphic resolution allows almost any fine representation of z. B. Lineweights. However, the generating programs often only use a 72- DPI resolution for graphics exchange via the clipboard, which is just sufficient for the screen display.

Vulnerability in WMF

On December 28, 2005, an exploit was discovered that took advantage of a bug in the processing of WMF files. This error is contained in all versions from Microsoft Windows 3.0, but can only be exploited from version Microsoft Windows 2000 . With its help, any code, including malicious ones, can be executed. The execution is already triggered by viewing a prepared WMF file. This vulnerability only became public knowledge with the appearance of the first exploiting viruses. Microsoft recommends installing the security update released by Microsoft on January 5, 2006 in order to close the security hole.

Notes on the WMF specification

  • The smallest possible unit of measurement in WMF files is the twip . WMF is a binary format with 16-bit integer numbers, so the range of values ​​for the coordinates is limited to ± 32,767. Because WMF files can freely choose their resolution within the specifications, the maximum edge length of a finely resolved file is e.g. B.
    1 twip × 65,536 = 65,536 twip (~ 1155.98 mm)
    or a file that has a resolution of 72 DPI :
    1 point × 65,536 = 65,536 points (~ 23,121.1 mm).
  • WMF files have to be appended a 18-byte header (header) to which almost any number of sections (records) with object definitions on functions of Windows - GDI draw.
    For exchange across program boundaries, many programs add an additional 22-byte header to the WMF file, which can be recognized by the hexadecimal start bytes D7-CD-C6-9A (interpreted as INTEL 32-bit DWORD: 9AC6CDD7).

According to the Microsoft Knowledge Base, the WMF file format was probably changed slightly in 2000 (which means that FrontPage 2000/2002 imports older WMF files in the wrong size). So there seem to be different versions.

The complete specification has been published on CD in the “Microsoft Developer Network” (MSDN).

Windows Enhanced Metafile (EMF)

Windows Enhanced Metafile (EMF) is a further development of WMF. In contrast to WMF, it uses a 32-bit format for the definition of image coordinates. EMF is also used as a printer language.

Web links