Introduction
BMP is the bitmap image format that Microsoft and IBM shared in Windows and OS/2 in the late 1980s. A BMP file holds a device independent bitmap (DIB): a header describing the image, an optional palette and the pixels, usually uncompressed. It begins with a 14-byte file header whose first two bytes are a type code.
Windows only ever writes the type BM, and almost every .bmp
file is one of those. OS/2’s Presentation Manager reused the same header for its icons,
mouse pointers and collections of bitmaps, giving each a type code of its own. These
files are built from the same parts as a BM bitmap, but are put together
differently, so each has its own page here.
Variations
| Format | Variation | About | Open |
|---|---|---|---|
.BMP | Windows bitmap (BM) | Windows bitmaps: a header, an optional palette and rows of pixels. | Open |
.BMP | OS/2 bitmap array (BA) | Several OS/2 bitmaps, icons or pointers for different screens, chained in one file. | Open |
.ICO | OS/2 icon (IC) | A black and white OS/2 icon: AND and XOR masks in one 1-bit bitmap. | Open |
.ICO | OS/2 colour icon (CI) | A colour OS/2 icon: a 1-bit mask bitmap followed by a colour image. | Open |
.PTR | OS/2 pointer (PT) | A black and white OS/2 mouse pointer, with its hotspot in the header. | Open |
.PTR | OS/2 colour pointer (CP) | A colour OS/2 mouse pointer: masks, a colour image and a hotspot. | Open |
Windows bitmap (BM)
The ordinary bitmap, written by Windows, OS/2 and nearly every image program. A file header is followed by a DIB header, an optional colour table or set of bit masks, and the rows of pixels, bottom row first. The DIB header has grown over the years, from 12 bytes in Windows 2.0 and OS/2 1.x to 124 bytes in Windows 98, and its first four bytes give its size and so its version.
The file starts with BM (42 4D). The four bytes at offset
14 hold the DIB header size: 12, 16 to 64, 108 or 124.
OS/2 bitmap array (BA)
A chain of bitmaps in one file, each made for a different screen. OS/2 used it so one icon, pointer or picture could carry versions for low and high resolution displays, and let the system pick the best fit. Each entry is an array header followed by a complete bitmap, icon or pointer.
The file starts with BA (42 41). At offset 14 a second type
code begins the first entry’s own file header, usually BM,
IC, CI, PT or CP. These files may
be named .bmp, .ico or .ptr.
OS/2 icon (IC)
A black and white OS/2 icon. It is a single 1-bit bitmap twice the icon’s height, holding two masks one above the other: together they make each pixel black, white, transparent or the inverse of what is behind it.
The file starts with IC (49 43), and the bitmap’s height is
twice its width. It is usually named .ico, which on Windows means a
different format.
OS/2 colour icon (CI)
A colour OS/2 icon. It holds two bitmaps one after the other: the same 1-bit pair of masks as a black and white icon, then a colour image that fills in the visible pixels.
The file starts with CI (43 49), and a second
CI file header follows the first bitmap’s headers and palette. It is
usually named .ico.
OS/2 pointer (PT)
A black and white OS/2 mouse pointer. It is laid out exactly like a black and white icon; the two fields that are reserved in a bitmap give the hotspot, the pixel that marks where the pointer points.
The file starts with PT (50 54) and is usually named
.ptr.
OS/2 colour pointer (CP)
A colour OS/2 mouse pointer. It is laid out exactly like a colour icon, with the hotspot in the file header.
The file starts with CP (43 50), followed later by a second
CP file header for the colour image. It is usually named
.ptr.
Also used for
- Windows icon .ico
Links
Reference
- Bitmap Storage, Microsoft’s description of the BMP file layout