BMP

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m
m (Various)
 
(61 intermediate revisions by 9 users not shown)
Line 2: Line 2:
 
|formattype=electronic
 
|formattype=electronic
 
|subcat=Graphics
 
|subcat=Graphics
|extensions={{ext|bmp}}<br>{{ext|dib}}<br>{{ext|rle}}
+
|extensions={{ext|bmp}}, {{ext|rle}}, {{ext|dib}}, others
 +
|mimetypes={{mimetype|image/bmp}}
 +
|locfdd={{LoCFDD|fdd000189}}
 
|pronom={{PRONOM|fmt/116}}, others
 
|pronom={{PRONOM|fmt/116}}, others
 +
|wikidata={{wikidata|Q192869}}
 +
|kaitai struct=bmp
 +
|released=1987
 
}}
 
}}
'''BMP''' is a family of simple raster graphics image file formats designed to store bitmap digital images independently of a display device.  BMP was originally and is 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.
+
'''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.
  
== Identification ==
+
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.
 +
 
 +
== Discussion ==
 +
The term ''DIB'' can mean several different things:
 +
* A synonym for BMP file format.
 +
* An in-memory DIB object, with no file header. The header data and the bitmap data do not have to be stored contiguously. Some Win32 API functions use this format.
 +
* A "packed DIB" memory object or file component, with no file header. The header data and the bitmap data are stored contiguously. This is a standard [[Windows clipboard|clipboard format]], for example.
 +
* A "packed DIB" stored in a file by itself.
 +
 
 +
A number of Windows-centric formats contain some nonstandard modified or compressed form of BMP/DIB, intended to be reconstructed as a DIB at runtime.
 +
 
 +
== Format details ==
 +
 
 +
=== Compression ===
 +
Images are usually uncompressed, but [[Run-length encoding|RLE]] compression can be used under some conditions. [[JPEG]], [[PNG]], and [[Modified Huffman|Huffman 1D]] compression are also theoretically possible, but rarely supported.
 +
 
 +
=== File structure ===
 +
A BMP file starts with a 14-byte "BITMAPFILEHEADER" structure.
 +
 
 +
Immediately after that is another header which we'll refer to as the "info header", though some versions of it are named "core header" instead. There are a number of different versions and sub-versions of it. It starts with 4-byte integer indicating its size, which ''mostly'' reveals its version.
 +
 
 +
The pixel data is pointed to by a field in BITMAPFILEHEADER. There can be other data segments, e.g. for a color palette, before (and, rarely, after) the pixel data.
 +
 
 +
Pixel data is usually stored from bottom up (but is top-down if the header indicates a negative height). If uncompressed, each row is padded to a multiple of 4 bytes.
 +
 
 +
== Identifiers ==
 
No MIME type has been officially registered. Strings found in practice are:  image/bmp; image/x-bmp; image/x-ms-bmp
 
No MIME type has been officially registered. Strings found in practice are:  image/bmp; image/x-bmp; image/x-ms-bmp
  
The standard file extension is '''.bmp'''. Reportedly, '''.dib''' and '''.rle''' have occasionally been used.
+
The usual filename extension is '''.bmp'''. Extensions '''.rle''' (for RLE-compressed images) and '''.dib''' (which sometimes 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 <code>'B' 'M' ?? ?? 00 00 00 00</code>.
+
== Identification ==
 +
BMP files start with the ASCII signature "{{magic|BM}}".
  
== Well-known versions ==
+
The bytes at the beginning of the file match one of these two patterns:
  
Unless otherwise indicated, BMP files all 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.
+
42 4d ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 00 00 0c 00
 +
00 00 ?? ?? ?? ?? 01 00 ?? 00
 +
 
 +
or
 +
 
 +
42 4d ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 00 00 ?? 00
 +
00 00 ?? ?? ?? ?? ?? ?? ?? ?? 01 00 ?? 00
 +
 
 +
The "reserved" bytes at offset 6 to 9 are usually all zero, but a few OS/2 BMP files have nonzero "hotspot coordinates" there.
 +
 
 +
Compare to [[VBM (VDC BitMap)]], an obscure format with a similar signature.
 +
 
 +
== Well-known versions ==
  
 
=== Windows BMP v2 ===
 
=== Windows BMP v2 ===
 
* Info header size: 12
 
* Info header size: 12
* Info header name: BITMAPCOREHEADER or OS21XBITMAPHEADER
+
* Info header name: BITMAPCOREHEADER
 
* PRONOM: {{PRONOM|fmt/115}}
 
* PRONOM: {{PRONOM|fmt/115}}
  
Also known as OS/2 BMP 1.0.
+
See also OS/2 BMP 1.0, below.
  
 
=== Windows BMP v3 ===
 
=== Windows BMP v3 ===
 
* Info header size: 40
 
* Info header size: 40
 
* Info header name: BITMAPINFOHEADER
 
* Info header name: BITMAPINFOHEADER
* PRONOM: {{PRONOM|fmt/116}} (1, 4, 8, 24 bits/pixel), {{PRONOM|fmt/117}} (16, 32 bits/pixel)
+
* PRONOM: {{PRONOM|fmt/116}}, {{PRONOM|fmt/117}}
  
This is by far the most widely used version of BMP.
+
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.
  
When 16 or 32 bits/pixel is supported, the format may be known as "BMP 3.0 NT".
+
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.
  
Note: It's possible that some OS/2 BMP 2.0 files also have a header size of 40.
+
Microsoft's GDI+ reportedly supports BMP images with 64 bits/pixel[https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-types-of-bitmaps-about], but no technical documentation of this extension has been located.
 +
 
 +
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 ===
 
=== Windows BMP v4 ===
Line 40: Line 85:
 
* Info header name: BITMAPV4HEADER
 
* Info header name: BITMAPV4HEADER
 
* PRONOM: {{PRONOM|fmt/118}}
 
* PRONOM: {{PRONOM|fmt/118}}
 +
 +
Introduced with Windows 95. Adds support for transparency and colorimetry.
  
 
=== Windows BMP v5 ===
 
=== Windows BMP v5 ===
Line 45: Line 92:
 
* Info header name: BITMAPV5HEADER
 
* Info header name: BITMAPV5HEADER
 
* PRONOM: {{PRONOM|fmt/119}}
 
* PRONOM: {{PRONOM|fmt/119}}
 +
 +
Introduced with Windows 98. Adds support for [[ICC profile|ICC profiles]].
  
 
== Other versions ==
 
== Other versions ==
Line 51: Line 100:
 
* PRONOM: {{PRONOM|fmt/114}}
 
* PRONOM: {{PRONOM|fmt/114}}
  
Based on limited information, this format does not use the usual 14-byte header. The file extension may be '''.bmp''' or '''.ddb'''.
+
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|OS/2 BMP disambiguation page]].''
 +
* Info header size: 12
 +
* Info header name: BITMAPCOREHEADER or OS21XBITMAPHEADER
 +
* PRONOM: {{PRONOM|x-fmt/25}} (deprecated), {{PRONOM|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 ===
 
=== OS/2 BMP 2.0 ===
* Info header size: 16, 40, 48, or 64 (?)
+
* Info header size: 16–64 (16, 24, 40, 48, and 64 may be most common)
 
* Info header name: BITMAPCOREHEADER2 or OS22XBITMAPHEADER
 
* Info header name: BITMAPCOREHEADER2 or OS22XBITMAPHEADER
 
* PRONOM: {{PRONOM|x-fmt/270}}
 
* PRONOM: {{PRONOM|x-fmt/270}}
  
See [[OS/2 BMP]].
+
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.
  
 
=== BITMAPV2INFOHEADER ===
 
=== BITMAPV2INFOHEADER ===
Line 64: Line 127:
 
* Info header name: BITMAPV2INFOHEADER
 
* Info header name: BITMAPV2INFOHEADER
  
No details known.
+
Uncertain; possibly an abbreviated V4/V5 header.
  
 
=== BITMAPV3INFOHEADER ===
 
=== BITMAPV3INFOHEADER ===
Line 70: Line 133:
 
* Info header name: BITMAPV3INFOHEADER
 
* Info header name: BITMAPV3INFOHEADER
  
No details known.
+
Uncertain; possibly an abbreviated V4/V5 header.
 +
 
 +
=== Packed DIB file ===
 +
Same as the common BMP formats, but omits the 14-byte ''file header''.
 +
 
 +
=== 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 "<code>BA</code>". (But note that deleting this header is not quite enough to get a valid BMP file.)
 +
 
 +
== Symbol definitions ==
 +
Here are the definitions, from the Windows SDKs, of some of the symbols used in the BMP documentation.
 +
 
 +
All integers use little-endian [[Endianness|byte order]].
 +
 
 +
{| class="wikitable"
 +
! Symbol
 +
! Definition
 +
|-
 +
|WORD || unsigned 16-bit integer
 +
|-
 +
|DWORD || unsigned 32-bit integer
 +
|-
 +
|LONG || signed 32-bit integer
 +
|-
 +
|BI_RGB || 0
 +
|-
 +
|BI_RLE8 || 1
 +
|-
 +
|BI_RLE4 || 2
 +
|-
 +
|BI_BITFIELDS || 3
 +
|-
 +
|(Huffman 1D) || 3
 +
|-
 +
|BI_JPEG || 4
 +
|-
 +
|(24-bit RLE) || 4
 +
|-
 +
|BI_PNG || 5
 +
|-
 +
|BI_ALPHABITFIELDS || 6
 +
|-
 +
|BI_SRCPREROTATE || 0x8000 (?)
 +
|-
 +
|LCS_CALIBRATED_RGB || 0
 +
|-
 +
|LCS_sRGB || <code>'sRGB'</code> = 0x73524742
 +
|-
 +
|LCS_WINDOWS_COLOR_SPACE || <code>'Win '</code> = 0x57696e20
 +
|-
 +
|PROFILE_LINKED || <code>'LINK'</code> = 0x4c494e4b
 +
|-
 +
|PROFILE_EMBEDDED || <code>'MBED'</code> = 0x4d424544
 +
|-
 +
|LCS_GM_BUSINESS || 1
 +
|-
 +
|LCS_GM_GRAPHICS || 2
 +
|-
 +
|LCS_GM_IMAGES || 4
 +
|-
 +
|LCS_GM_ABS_COLORIMETRIC || 8
 +
|}
  
 
== Specifications ==
 
== Specifications ==
* [http://msdn.microsoft.com/en-us/library/dd183374%28v=vs.85%29.aspx BITMAPFILEHEADER]
+
* Most of the format (but not the BITMAPFILEHEADER) is defined in the [https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-wmf/4813e7fd-52d0-4f42-965f-228c8b7488d2 Windows Metafile Specification] (as "DeviceIndependentBitmap")
* [http://msdn.microsoft.com/en-us/library/dd183372%28v=vs.85%29.aspx BITMAPCOREHEADER]
+
* Defined in the [https://www.aelius.com/njh/wavemetatools/doc/riffmci.pdf RIFF specification] (as Device Independent Bitmap File Format)
* [http://msdn.microsoft.com/en-us/library/dd183376%28v=vs.85%29.aspx BITMAPINFOHEADER]
+
* [https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapfileheader BITMAPFILEHEADER]
* [http://msdn.microsoft.com/en-us/library/dd183380%28v=vs.85%29.aspx BITMAPV4HEADER]
+
* [https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapcoreheader BITMAPCOREHEADER]
* [http://msdn.microsoft.com/en-us/library/dd183381%28v=vs.85%29.aspx BITMAPV5HEADER]
+
* [https://docs.microsoft.com/en-us/previous-versions/dd183376(v=vs.85) BITMAPINFOHEADER]
 +
* [https://docs.microsoft.com/en-us/previous-versions/windows/embedded/aa452885(v=msdn.10) BITMAPINFOHEADER (Windows CE 5.0)]
 +
* [https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv4header BITMAPV4HEADER]
 +
* [https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv5header BITMAPV5HEADER]
 +
* [http://www.digicamsoft.com/bmp/bmp.html Another site with format descriptions]
 +
* [http://www.fileformat.info/format/os2bmp/spec/902d5c253f2a43ada39c2b81034f27fd/view.htm OS/2 Presentation Manager Programming Reference Guide, Vol III]
 +
* [http://whatis.rest7.com/how-to-open-bmp-file Specification of BMP headers]
 +
* [http://zig.tgschultz.com/bmp_file_format.txt BMP format information by T. Schultz]
 +
 
 +
== Metaformat files ==
 +
 
 +
* {{Synalysis|bitmap}}
 +
 
 +
== Software ==
 +
BMP is widely supported by graphics software, including web browsers. Software listed here has been arbitrarily selected.
 +
* [[Netpbm]]: bmptopnm, ppmtobmp
 +
* [[ImageMagick]]
 +
* [[XnView]]
 +
* [[Tom's Viewer]]
 +
* {{Reggae}}
 +
 
 +
== Sample files ==
 +
=== Windows BMP v2 ===
 +
This format is fairly common, but examples of it can be hard to spot amidst all the BMPv3 files.
 +
* [https://samples.libav.org/image-samples/money-2-%28os2%29.bmp money-2-(os2).bmp], [https://samples.libav.org/image-samples/money-16-%28os2%29.bmp money-16-(os2).bmp], [https://samples.libav.org/image-samples/money-256-%28os2%29.bmp money-256-(os2).bmp], [https://samples.libav.org/image-samples/money-24bit-os2.bmp money-24bit-os2.bmp]
 +
* {{CdTextfilesURL|hobbesos29709/disk2/MULTIMED/BMP/}} → BMPS*.ZIP, OS2ORBIT.ZIP, REALMERL.BMP
 +
 
 +
=== Windows BMP v3 ===
 +
* {{CdTextfilesURL|mmplatinum/IMAGES/BMP/}}
 +
* {{CdTextfilesURL|monstmedia/WIN/ICONS/}}
 +
* {{CdTextfilesURL|maxx/tothemaxww/BMPMISC/}}
 +
 
 +
=== OS/2 BMP 2.0 ===
 +
* [http://kimludvigsen.dk/os2/os2/graphx/teamlog2.zip teamlog2.zip] → TEAMcol.bmp, teamcol2.bmp
 +
* [https://samples.libav.org/image-samples/bmp-files/test4os2v2.bmp test4os2v2.bmp]
 +
* {{CdTextfiles|hobbesos29709/disk2/MULTIMED/BMP/CARDBMPS.ZIP|CARDBMPS.ZIP}} - Most of the files are OS/2 BMP 2.0
 +
* {{CdTextfiles|hobbesos29709/disk1/GAMES/MAKMAN10.ZIP|MAKMAN10.ZIP}} - Some of the files are files OS/2 BMP 2.0
 +
* {{CdTextfiles|monstmedia/IMAGES/JUR_OS2.BMP|JUR_OS2.BMP}}
 +
* {{CdTextfilesURL|pier/pier09/cdrom/036/}} → os2bmp*.zip
 +
 
 +
=== Various ===
 +
* [http://wvnvms.wvnet.edu/vmswww/bmp.html Example BMP images (all Windows v3 except as indicated)]
 +
* [https://archive.org/details/OS2BBS OS/2 BBS Files Archive] → 13-Bitmap.zip - Lots of OS/2 BMP 1.0 & 2.0 files
 +
* [https://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html BMP Suite Image List]
 +
* {{DexvertSamples|image/bmp}}
  
== Sample images ==
+
== See also ==
* [http://wvnvms.wvnet.edu/vmswww/bmp.html Example BMP images (all Windows V3 except as indicated)]
+
* [[CUR]]
* [http://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html BMP Suite Image List]
+
* [[ICO]]
 +
* [[KQP]]
 +
* [[OS/2 bitmap family]]
 +
* [[OS/2 Bitmap Array]]
 +
* [[packPNM]]
 +
* [[Pegasus PIC]]
 +
* [[Pocket PC Bitmap]]
 +
* [[Poser Bump Map]]
 +
* [[Segmented Hypergraphics]]
 +
* [[Windows DDB]]
 +
* [[Winzle Puzzle]]
 +
* BMP is sometimes used as a base format for [[steganography]] and similar things. For examples, see:
 +
** [[Data Hiding/Embedding#BMP]]
 +
** [[Encryption#Obfuscation]]
 +
** [[Encryption#Steganography]]
  
== References ==
+
== Links ==
* [http://en.wikipedia.org/wiki/BMP_%28file_format%29 BMP (file format): Wikipedia]
+
* [[Wikipedia:BMP file format|Wikipedia: BMP file format]]
* [http://www.digitalpreservation.gov/formats/fdd/fdd000189.shtml Bitmap Image File (BMP), Version 5, from Library of Congress resource on Sustainability of Digital Formats]
+
* {{EGFF|bmp|Microsoft Windows Bitmap File Format Summary}}, from the [[Encyclopedia of Graphics File Formats]]
* [http://www.fileformat.info/format/bmp/egff.htm Microsoft Windows Bitmap File Format Summary] From Encyclopedia of Graphics File Formats at FileFormat.Info (1996)
+
* {{EGFF|os2bmp|OS/2 Bitmap File Format Summary}}, from the [[Encyclopedia of Graphics File Formats]]
 +
* [http://coptr.digipres.org/Bad_Peggy Bad Peggy: scans images for problems]
 +
* [https://web.archive.org/web/20190919034602/http://forensicswiki.org/wiki/BMP ForensicsWiki entry] (not much useful info except for a link to an iOS tool for reading metadata)
 +
* [https://github.com/corkami/pics/blob/master/binary/BMP.png Graphic documenting format]
  
 
[[Category:Microsoft]]
 
[[Category:Microsoft]]
 +
[[Category:Windows]]
 +
[[Category:OS/2]]

Latest revision as of 04:20, 28 December 2023

File Format
Name BMP
Ontology
Extension(s) .bmp, .rle, .dib, others
MIME Type(s) image/bmp
LoCFDD fdd000189
PRONOM fmt/116, others
Wikidata ID Q192869
Kaitai Struct Spec bmp.ksy
Released 1987

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.

Contents

[edit] Discussion

The term DIB can mean several different things:

  • A synonym for BMP file format.
  • An in-memory DIB object, with no file header. The header data and the bitmap data do not have to be stored contiguously. Some Win32 API functions use this format.
  • A "packed DIB" memory object or file component, with no file header. The header data and the bitmap data are stored contiguously. This is a standard clipboard format, for example.
  • A "packed DIB" stored in a file by itself.

A number of Windows-centric formats contain some nonstandard modified or compressed form of BMP/DIB, intended to be reconstructed as a DIB at runtime.

[edit] Format details

[edit] Compression

Images are usually uncompressed, but RLE compression can be used under some conditions. JPEG, PNG, and Huffman 1D compression are also theoretically possible, but rarely supported.

[edit] File structure

A BMP file starts with a 14-byte "BITMAPFILEHEADER" structure.

Immediately after that is another header which we'll refer to as the "info header", though some versions of it are named "core header" instead. There are a number of different versions and sub-versions of it. It starts with 4-byte integer indicating its size, which mostly reveals its version.

The pixel data is pointed to by a field in BITMAPFILEHEADER. There can be other data segments, e.g. for a color palette, before (and, rarely, after) the pixel data.

Pixel data is usually stored from bottom up (but is top-down if the header indicates a negative height). If uncompressed, each row is padded to a multiple of 4 bytes.

[edit] Identifiers

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 sometimes indicates that the file lacks a file header) are also sometimes seen. Many other extensions have been used by various applications.

[edit] Identification

BMP files start with the ASCII signature "BM".

The bytes at the beginning of the file match one of these two patterns:

42 4d ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 00 00 0c 00 
00 00 ?? ?? ?? ?? 01 00 ?? 00

or

42 4d ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 00 00 ?? 00 
00 00 ?? ?? ?? ?? ?? ?? ?? ?? 01 00 ?? 00

The "reserved" bytes at offset 6 to 9 are usually all zero, but a few OS/2 BMP files have nonzero "hotspot coordinates" there.

Compare to VBM (VDC BitMap), an obscure format with a similar signature.

[edit] Well-known versions

[edit] Windows BMP v2

  • Info header size: 12
  • Info header name: BITMAPCOREHEADER
  • PRONOM: fmt/115

See also OS/2 BMP 1.0, below.

[edit] Windows BMP v3

  • Info header size: 40
  • Info header name: BITMAPINFOHEADER
  • PRONOM: fmt/116, fmt/117

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.

Microsoft's GDI+ reportedly supports BMP images with 64 bits/pixel[1], but no technical documentation of this extension has been located.

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.

[edit] Windows BMP v4

  • Info header size: 108
  • Info header name: BITMAPV4HEADER
  • PRONOM: fmt/118

Introduced with Windows 95. Adds support for transparency and colorimetry.

[edit] Windows BMP v5

  • Info header size: 124
  • Info header name: BITMAPV5HEADER
  • PRONOM: fmt/119

Introduced with Windows 98. Adds support for ICC profiles.

[edit] Other versions

[edit] Windows BMP v1

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.

[edit] 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.

[edit] 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.

[edit] BITMAPV2INFOHEADER

  • Info header size: 52
  • Info header name: BITMAPV2INFOHEADER

Uncertain; possibly an abbreviated V4/V5 header.

[edit] BITMAPV3INFOHEADER

  • Info header size: 56
  • Info header name: BITMAPV3INFOHEADER

Uncertain; possibly an abbreviated V4/V5 header.

[edit] Packed DIB file

Same as the common BMP formats, but omits the 14-byte file header.

[edit] 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.)

[edit] Symbol definitions

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.

Symbol Definition
WORD unsigned 16-bit integer
DWORD unsigned 32-bit integer
LONG signed 32-bit integer
BI_RGB 0
BI_RLE8 1
BI_RLE4 2
BI_BITFIELDS 3
(Huffman 1D) 3
BI_JPEG 4
(24-bit RLE) 4
BI_PNG 5
BI_ALPHABITFIELDS 6
BI_SRCPREROTATE 0x8000 (?)
LCS_CALIBRATED_RGB 0
LCS_sRGB 'sRGB' = 0x73524742
LCS_WINDOWS_COLOR_SPACE 'Win ' = 0x57696e20
PROFILE_LINKED 'LINK' = 0x4c494e4b
PROFILE_EMBEDDED 'MBED' = 0x4d424544
LCS_GM_BUSINESS 1
LCS_GM_GRAPHICS 2
LCS_GM_IMAGES 4
LCS_GM_ABS_COLORIMETRIC 8

[edit] Specifications

[edit] Metaformat files

[edit] Software

BMP is widely supported by graphics software, including web browsers. Software listed here has been arbitrarily selected.

[edit] Sample files

[edit] Windows BMP v2

This format is fairly common, but examples of it can be hard to spot amidst all the BMPv3 files.

[edit] Windows BMP v3

[edit] OS/2 BMP 2.0

[edit] Various

[edit] See also

[edit] Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox