The BMP File Format

Also known as: RLE, LGO


Original Documentation

The BMP files are the way, Windows stores bit mapped images. The BMP image
data is bit packed but every line must end on a dword boundary - if thats not
the case, it must be padded with zeroes. BMP files are stored bottom-up,
that means that the first scan line is the bottom line. The BMP format has four
incarnations, two under Windows (new and old) and two under OS/2, all are
described here.
OFFSET              Count TYPE   Description
0000h                   2 char   ID='BM' - BitMap
								 OS/2 also supports the following IDs :
								 ID='BA' - Bitmap Array
								 ID='CI' - Color Icon
								 ID='CP' - Color Pointer (mouse cursor)
								 ID='IC' - Icon
								 ID='PT' - Pointer (mouse cursor)
0002h                   1 dword  Filesize of whole file
0006h                   4 byte   reserved
000Ah                   1 dword  Offset of bitmap in file
								 ="BOF"
000Eh                   1 dword  Length of BitMapInfoHeader
								 The BitMapInfoHeader starts directly after
								 this header.
								 12 - OS/2 1.x format
								 40 - Windows 3.x format
								 64 - OS/2 2.x format
0012h                   1 dword  Horizontal width of bitmap in pixels
0016h                   1 dword  Vertical width of bitmap in pixels
001Ah                   1 word   Number of planes
001Ch                   1 word   Bits per pixel ( thus the number of colors )
								 ="BPP"
001Eh                   1 dword  Compression type, see ALGRTHMS.txt for descrip-
								 tion of the different types
								 0 - none
								 1 - RLE 8-bit/Pixel
								 2 - RLE 4-bit/Pixel
0022h                   1 dword  Size of picture in bytes
0026h                   1 dword  Horizontal resolution
002Ah                   1 dword  Vertical resolution
002Ah                   1 dword  Number of used colors
002Ah                   1 dword  Number of important colors
0036h                   ? rec    Definition of N colors
								 N=1 shl "BPP"
						1 byte   Blue component
						1 byte   Green component
						1 byte   Red component
						1 byte   Filler
"BOF"                   ? byte   Image data
EXTENSION:BMP,RLE,LGO
OCCURENCES:PC
PROGRAMS:Windows,Paintbrush
REFERENCE:DDJ0994
VALIDATION:
SEE ALSO:rDIB

This information is from Corion.net and is used with permission.

More Resources