What is .bmp file?
Microsoft Windows bitmap is a raster image file originating from Windows. It was created by Microsoft for Windows.Images are compressed.
Files always begin with ASCII string "BM".
File extension is .bmp.
Software handling .bmp files
Rest7 Free Online ConverterStructure of .bmp images
There are a few variants of BMP files.The first header is 14 bytes long in every BMP file.
Name | Type | Description |
---|---|---|
Magic | Char8[2] | Always = 'BM' |
BmpSize | UInt32 | Size of the file (unreliable) |
Reserved | UInt16 | = 0 |
Reserved | UInt16 | = 0 |
ImageOffset | UInt32 | Absolute offset where image data starts |
BMP version 3
Second header (named BITMAPINFOHEADER) for BMP version 3 (most popular) is 40 bytes long. It was introduced in Windows 3.1x and Windows NT.Name | Type | Description |
---|---|---|
SizeOfHeader | UInt32 | = 40 for BMP version 3 |
Width | UInt32 | |
Height | UInt32 | |
PlanesCount | UInt16 | = 1 |
BitsPerPixel | UInt16 | = 1, 4, 8 or 24 |
Compression | UInt32 | 0 = none 1 = RLE 8bpp 2 = RLE 4bpp 4 = JPEG 5 = PNG |
ImageDataSize | UInt32 | Size of image data in bytes (including paddings) |
XResolution | UInt32 | Horizontal resolution in pixels/meter |
YResolution | UInt32 | Vertical resolution in pixels/meter |
ColorsCount | UInt32 | Number of colors in the image or 0 |
ImportantColorsCount | UInt32 | Number of important colors in the image or 0 |
BMP version 1
Second header (named BITMAPCOREHEADER) for BMP version 1 is 12 bytes long.It was introduced in Windows 2.0 and IBM OS/2 1.x
Name | Type | Description |
---|---|---|
SizeOfHeader | UInt32 | = 12 for BMP version 1 |
Width | UInt16 | |
Height | UInt16 | |
PlanesCount | UInt16 | = 1 |
BitsPerPixel | UInt16 | = 1, 4, 8 or 24 |
BMP version 2
Second header (named OS22XBITMAPHEADER) for BMP version 2 is 64 bytes long.It was introduced in IBM OS/2 2.x
Name | Type | Description |
---|---|---|
SizeOfHeader | UInt32 | = 64 for BMP version 2 |
Width | UInt32 | |
Height | UInt32 | |
PlanesCount | UInt16 | = 1 |
BitsPerPixel | UInt16 | |
Compression | UInt32 | |
ImageDataSize | UInt32 | |
XResolution | UInt32 | |
YResolution | UInt32 | |
ColorsCount | UInt32 | Number of colors in the image or 0 |
ImportantColorsCount | UInt32 | Number of important colors in the image or 0 |
Units | UInt16 | Units used to measure resolution |
Padding | UInt16 | |
Recoding | UInt16 | Recording algorithm |
Rendering | UInt16 | Halftoning algorithm used |
Size1 | UInt32 | Reserved for halftoning algorithm use |
Size3 | UInt32 | Reserved for halftoning algorithm use |
ColorEncoding | UInt32 | Color model used in bitma |
Identifier | UInt32 | Reserved for application |
BMP version 4
Second header (named BITMAPV4HEADER) for BMP version 4 (used mostly to embed JPEGs and PNGS inside BMP) is 108 bytes long. It was introduced in Windows NT 4.0 and Windows 95.Name | Type | Description |
---|---|---|
SizeOfHeader | UInt32 | = 108 for BMP version 4 |
Width | Int32 | |
Height | Int32 | Negative value means a top-down image |
PlanesCount | UInt16 | = 1 |
BitsPerPixel | UInt16 | 0 = JPEG or PNG 1 = monochrome 4 = 16 colors 8 = 256 colors 16 = 16 bpp RGB, for example 5 bits for R, 6 bits for G and 5 bits for B channel 24 = 24 bit RGB, 8 bits per channel 32 = 32 bit RGB |
Compression | UInt32 | 0 = none 1 = RLE 8bpp 2 = RLE 4bpp 4 = JPEG 5 = PNG |
ImageDataSize | UInt32 | Size of image data in bytes (including paddings) |
XResolution | UInt32 | Horizontal resolution in pixels/meter |
YResolution | UInt32 | Vertical resolution in pixels/meter |
ColorsCount | UInt32 | Number of colors in the image or 0 |
ImportantColorsCount | UInt32 | Number of important colors in the image or 0 |
RedMask | UInt32 | Bit mask for R channel |
GreenMask | UInt32 | Bit mask for G channel |
BlueMask | UInt32 | Bit mask for B channel |
AlphaMask | UInt32 | Bit mask for A channel |
CSType | UInt32 | The color space of the DIB. |
EndPoints | UInt8[36] | A CIEXYZTRIPLE structure that specifies the x, y, and z coordinates. 36 bytes in total. These are 3 values (for R, G and B). Each value has 3 values (x,y and z). Each value is of type FXPT2DOT30 (fixed-point values with a 2-bit integer part and a 30-bit fractional part) |
GammaRed | UInt32 | Tone response curve for red |
GammaGreen | UInt32 | Tone response curve for green |
GammaBlue | UInt32 | Tone response curve for blue |
BMP version 5
Second header (named BITMAPV5HEADER) for BMP version 5 is 124 bytes long. It was introduced in Windows NT 5.0 and Windows 98.Name | Type | Description |
---|---|---|
SizeOfHeader | UInt32 | = 124 for BMP version 5 |
Width | Int32 | |
Height | Int32 | Negative value means a top-down image |
PlanesCount | UInt16 | = 1 |
BitsPerPixel | UInt16 | 0 = JPEG or PNG 1 = monochrome 4 = 16 colors 8 = 256 colors 16 = 16 bpp RGB, for example 5 bits for R, 6 bits for G and 5 bits for B channel 24 = 24 bit RGB, 8 bits per channel 32 = 32 bit RGB |
Compression | UInt32 | 0 = none 1 = RLE 8bpp 2 = RLE 4bpp 4 = JPEG 5 = PNG |
ImageDataSize | UInt32 | Size of image data in bytes (including paddings) |
XResolution | UInt32 | Horizontal resolution in pixels/meter |
YResolution | UInt32 | Vertical resolution in pixels/meter |
ColorsCount | UInt32 | Number of colors in the image or 0 |
ImportantColorsCount | UInt32 | Number of important colors in the image or 0 |
RedMask | UInt32 | Bit mask for R channel |
GreenMask | UInt32 | Bit mask for G channel |
BlueMask | UInt32 | Bit mask for B channel |
AlphaMask | UInt32 | Bit mask for A channel |
CSType | UInt32 | The color space of the DIB. |
EndPoints | UInt8[36] | A CIEXYZTRIPLE structure that specifies the x, y, and z coordinates. 36 bytes in total. These are 3 values (for R, G and B). Each value has 3 values (x,y and z). Each value is of type FXPT2DOT30 (fixed-point values with a 2-bit integer part and a 30-bit fractional part) |
GammaRed | UInt32 | Tone response curve for red |
GammaGreen | UInt32 | Tone response curve for green |
GammaBlue | UInt32 | Tone response curve for blue |
Intent | UInt32 | Rendering intent for bitmap. |
ProfileData | UInt32 | Offset to profile data |
ProfileSize | UInt32 | Size in bytes of embedded profile data |
Reserved | UInt32 | = 0 |
Data types:
UInt8, UInt16, UInt32, UInt64 - Unsigned Integer 8 bit, 16 bit, 32 bit, 64 bit
Int8, Int16, Int32, Int64 - Signed Integer 8 bit, 16 bit, 32 bit, 64 bit
UMint16, UMint32 - Unsigned Motorola Integer 16 bit, 32 bit (Big Endian)
Char8, Char16 - Char 8 bit, 16 bit