BMP is a family of raster image file formats primarily used on Microsoft Windows and OS/2 operating systems. The format is sometimes known as Device-Independent Bitmap (DIB), since, when loaded into memory using Windows software, the image is held as a DIB structure.
Though seemingly a simple format, it is complicated by its many different versions, lack of an official specification, lack of any version control process, and ambiguities and contradictions in the documentation.
No MIME type has been officially registered. Strings found in practice are: image/bmp; image/x-bmp; image/x-ms-bmp
The usual filename extension is .bmp. Extensions .rle (for RLE-compressed images) and .dib (which usually indicates that the file lacks a file header) are also sometimes seen. Many other extensions have been used by various applications.
BMP files start with bytes
That's not a very distinctive signature, but it's hard to give any definite rules beyond that. The bytes at offset 6 to 9 are usually all zero, but a few OS/2 BMP files have nonzero "hotspot coordinates" at that location.
See also VBM (VDC BitMap), which has a similar signature.
BMP files use a common 14-byte file header, named BITMAPFILEHEADER. Following that is the "Info header", which begins with a 4-byte integer indicating its size. The Info header size (mostly) reveals the version of BMP that the file uses.
Windows BMP v2
- Info header size: 12
- Info header name: BITMAPCOREHEADER
- PRONOM: fmt/115
See also OS/2 BMP 1.0, below.
Windows BMP v3
This is by far the most widely used version of BMP. It was introduced with Windows 3.x. Windows NT extended it to support 16 and 32 bits/pixel.
Windows CE also extended it, for example to allow 2 bits/pixel (see Pocket PC Bitmap), but its extensions were not migrated to the BMP v4 and v5 formats.
It is apparently possible for OS/2 BMP 2.0 format to masquerade as Windows BMP v3. The upshot is that if the compression type is 3 and the bit depth is 1, or the compression type is 4 and the bit depth is 24, then the file should be treated as OS/2 BMP 2.0.
Windows BMP v4
- Info header size: 108
- Info header name: BITMAPV4HEADER
- PRONOM: fmt/118
Introduced with Windows 95. Adds support for transparency and colorimetry.
Windows BMP v5
- Info header size: 124
- Info header name: BITMAPV5HEADER
- PRONOM: fmt/119
Introduced with Windows 98. Adds support for ICC profiles.
Windows BMP v1
- PRONOM: fmt/114
Also called DDB, this is the bitmap file format used by Windows 1.0. It's not really a BMP format. Refer to Windows DDB.
OS/2 BMP 1.0
- See also the OS/2 BMP disambiguation page.
- Info header size: 12
- Info header name: BITMAPCOREHEADER or OS21XBITMAPHEADER
- PRONOM: x-fmt/25 (deprecated), fmt/115
For practical purposes, OS/2 BMP 1.0 is identical to Windows BMP v2. But there can be at least one small difference: In OS/2 formats, the "Size" field at offset 2 (variously named "cbSize", "FileSize", or "bfSize") is sometimes set to the size of the headers, instead of the size of the file. For v1, that means it will be 26 (14+12). For v2, it can range from 30 to 78.
OS/2 BMP 2.0
- Info header size: 16–64 (16, 24, 40, 48, and 64 may be most common)
- Info header name: BITMAPCOREHEADER2 or OS22XBITMAPHEADER
- PRONOM: x-fmt/270
OS/2 BMP 2.0 defines several file subtypes; here we are describing only the "Bitmap" subtype (files with a signature of "BM"). For other subtypes, see OS/2 bitmap family.
The header size can be reduced from its full size of 64 bytes. Omitted fields are assumed to have a value of zero.
The fields in the first 40 bytes of the header are (nearly) identical to those in Windows BMP v3, v4, and v5. The remaining fields are different.
OS/2 BMP 2.0 supports compression types "Huffman 1D" and "RLE24", unlike any other version of BMP.
- Info header size: 52
- Info header name: BITMAPV2INFOHEADER
Possibly consists of, or includes, a single V2 color on top of a V3 info header; see , page 38
- Info header size: 56
- Info header name: BITMAPV3INFOHEADER
Possibly consists of, or includes, the combination of a V3 header and a single V3 color table entry; see , page 38
RMMP Color Table-Less v3 DIB
Based on the v3 Windows BMP format, but, like other DIBs, lacks file header; unlike other DIBs, this one lacks a color table, as well, even though it has 8 or less bits per pixel (which would usually necessitate one). This DIB type can only be found in RIFF Multimedia Movie files, and it is possible that the color table is stored somewhere else in the RMPP, as well.
The best way to read this file is currently to make a color scheme up and add it as a color table with a hex editor, which will change it into the next listed format. Some image software (e.g. Qt's, or whatever it is based on) will try to read these files anyway, using pixel bytes as a color table.
Windows Color Table DIB
Essentially the result of stripping the file header from a Windows BMP (of any version) that uses a color table. If the color table has less than 2^bits-per-pixel entries (i.e. if the color table is not completely used), ImageMagick will fail to decode these. See the RIFF standard, p. 36. DIBs are not RIFF files but are nonetheless in the standard.
Windows 24-bit DIB
A Windows BMP (of any version) with the file header removed, and 24-bit color (no color table). These DIBs are widely supported. See the RIFF standard, p. 36. DIBs are not RIFF files but are nonetheless in the standard.
OS/2 Bitmap Array
Sometimes, an OS/2 Bitmap Array file containing one or more bitmaps is considered to be a kind of BMP file. Such a file begins with an extra 14-byte header, with signature "
BA". (But note that deleting this header is not quite enough to get a valid BMP file.)
Here are the definitions, from the Windows SDKs, of some of the symbols used in the BMP documentation.
All integers use little-endian byte order.
|WORD||unsigned 16-bit integer|
|DWORD||unsigned 32-bit integer|
|LONG||signed 32-bit integer|
- BMP (as "DeviceIndependentBitmap") is defined in the Windows Metafile Specification
- BITMAPINFOHEADER (Windows CE 5.0)
- Another site with format descriptions
- OS/2 Presentation Manager Programming Reference Guide, Vol III
BMP is widely supported by graphics software, including web browsers. Software listed here has been arbitrarily selected.
Windows BMP v2
This format is fairly common, but examples of it can be hard to spot amidst all the BMPv3 files.
- money-2-(os2).bmp, money-16-(os2).bmp, money-256-(os2).bmp, money-24bit-os2.bmp
- http://cd.textfiles.com/hobbesos29709/disk2/MULTIMED/BMP/ → BMPS*.ZIP, OS2ORBIT.ZIP, REALMERL.BMP
Windows BMP v3
OS/2 BMP 2.0
- teamlog2.zip → TEAMcol.bmp, teamcol2.bmp
- CARDBMPS.ZIP - Most of the files are OS/2 BMP 2.0
- MAKMAN10.ZIP - Some of the files are files OS/2 BMP 2.0
- http://cd.textfiles.com/pier/pier09/cdrom/036/ → os2bmp*.zip
- Example BMP images (all Windows v3 except as indicated)
- OS/2 BBS Files Archive → 13-Bitmap.zip - Lots of OS/2 BMP 1.0 & 2.0 files
- BMP Suite Image List
- OS/2 bitmap family
- OS/2 Bitmap Array
- Pocket PC Bitmap
- Poser Bump Map
- Segmented Hypergraphics
- Windows DDB
- Winzle Puzzle