![]() |
![]() ![]() ![]() |
File Formats: BMP |
![]() |
| ||
![]() |
defined by
Microsoft
|
|
|
Name | Size | Description | ||
---|---|---|---|---|
Header | 14 bytes | Windows Structure: BITMAPFILEHEADER | ||
Signature | 2 bytes | 'BM' | ||
FileSize | 4 bytes | File size in bytes | ||
reserved | 4 bytes | unused (=0) | ||
DataOffset | 4 bytes | File offset to Raster Data | ||
InfoHeader | 40 bytes | Windows Structure: BITMAPINFOHEADER | ||
Size | 4 bytes | Size of InfoHeader =40 | ||
Width | 4 bytes | Bitmap Width | ||
Height | 4 bytes | Bitmap Height | ||
Planes | 2 bytes | Number of Planes (=1) | ||
BitCount | 2 bytes | Bits per Pixel
1 = monochrome palette. NumColors = 1 4 = 4bit palletized. NumColors = 16 8 = 8bit palletized. NumColors = 256 16 = 16bit RGB. NumColors = 65536 (?) 24 = 24bit RGB. NumColors = 16M |
||
Compression | 4 bytes | Type of Compression
0 = BI_RGB no compression 1 = BI_RLE8 8bit RLE encoding 2 = BI_RLE4 4bit RLE encoding |
||
ImageSize | 4 bytes | (compressed) Size of Image
It is valid to set this =0 if Compression = 0 |
||
XpixelsPerM | 4 bytes | horizontal resolution: Pixels/meter | ||
YpixelsPerM | 4 bytes | vertical resolution: Pixels/meter | ||
ColorsUsed | 4 bytes | Number of actually used colors | ||
ColorsImportant | 4 bytes | Number of important colors
0 = all |
||
ColorTable | 4 * NumColors bytes | present only if Info.BitsPerPixel <=
8
colors should be ordered by importance |
||
Red | 1 byte | Red intensity | ||
Green | 1 byte | Green intensity | ||
Blue | 1 byte | Blue intensity | ||
reserved | 1 byte | unused (=0) | ||
repeated NumColors times | ||||
Raster Data | Info.ImageSize bytes | The pixel data |
BitCount = 8 Compression = 1
|
n (byte 1) | c (Byte 2) | Description |
---|---|---|
>0 | any | n pixels of color number c |
0 | 0 | End-of-line |
0 | 1 | EndOfBitmap |
0 | 2 | Delta. The following 2 bytes define an unsigned offset in x and y direction (y being up) The skipped pixels should get a color zero. |
0 | >=3 | The following c bytes will be read as single pixel colors just as in uncompressed files. A zero follows, if c is odd, putting the file/memory pointer on a 16bit boundary again. |
Compressed Data | Expanded data |
---|---|
03 04 | 04 04 04 |
05 06 | 06 06 06 06 06 |
00 03 45 56 67 00 | 45 56 67 |
02 78 | 78 78 |
00 02 05 01 | Move 5 right and 1 up. (Windows docs say down, which is wrong) |
00 00 | End-of-line |
09 1E | 1E 1E 1E 1E 1E 1E 1E 1E 1E |
00 01 | End-of-bitmap |
00 00 | Zero padding for 32bit boundary |
Although BMPs were invented by Microsoft for
its Windows platform, a lot of programs on other platforms are capable
of reading and writing them. Notice the Intel order in 2byte and 4-byte
integer values (Least significant byte first). The 16bit BMPs have been
introduced to Windows after the others, still puzzling many applications. |
To my knowledge: None.
|
This section is for programmers, who wish
to cross-check their implementation with others. This is an incomplete
list of programs, which are available as freeware / shareware / try-before-buy
etc.
|
http://www.dcs.ed.ac.uk/~mxr/gfx/
|
|
This is not the official format documentation.
Although we're doing our best to keep this information as accurate as possible,
there is no way of checking all of it under all possible circumstances.
We're not taking any responsibility for the results of this information
or lack thereof. The 'trademarks, patents and royalties' section is here
just for your convenience, and is in no way complete. Please send us a
note, if you find any incorrect of missing information to fileformats@daubnet.com.
|
© Jörn Daub EDV-Beratung - Glashütter Weg 105 - D-22889 Tangstedt