The Bitmap, or BMP, file format was created by Microsoft for the Windows operating system. However, since it is such a popular format, it has support on all major operating systems, including Linux and MacOS X.
The bitmap file format supports a variety of color formats, ranging from monochrome (black and white) to 24bit (16777216 colors). The file format is lossless, even when used with the RLE compression option. Use of bitmap images is generally discouraged for game images and also for sharing images on the internet, due to their large file size. On the other hand, they're quite simple to read and write, so can be fine if inside some sort of archive or pack format that resolves the size issue. Note however, that most versions of Windows require that the program icon image to be a 32x32 pixel BMP file. The file is given an .ICO extension and the transparency is specified by the colour of the first pixel.
BYTES DATA EXPLANATION ***** **** *********** 0-1 BM The first two bytes must always contain the characters 'B' and 'M' 2-5 ? An integer containing the bitmap file's size, in bytes 6-7 0 Reserved bytes; must be zero 8-9 0 Reserved bytes; must be zero 10-13 ? Number of bytes from start of file to start of pixel data 14-17 40 Size of the remaining header fields, in bytes. 18-21 ? An integer containing the bitmap's width, in pixels 22-25 ? An integer containing the bitmap's height, in pixels: A positive value indicates that the lower-left is the origin pixel A negative value indicates that the upper-left is the origin pixel 26-27 1 Specifies the number of target "planes". Always set to 1 28-29 ? Bits of data per pixel. Can be 1, 2, 4, 8, 16, 24, or 32 30-33 ? Compression: 0 = No compression 1 = RLE compression for 8bit bitmaps 2 = RLE compression for 4bit bitmaps 3 = No compression, but indicates that 16 or 32bit bitmaps reference the color map for pixel data 34-37 ? Size of image data in bytes, rounded up to a 4 byte boundary 38-41 0 Horizonal pixels per meter (resolution). Can be set to zero 42-45 0 Vertical pixels per meter (resolution). Can be set to zero 46-49 0 Number of color map entries used. Set to zero for 'all' 50-53 0 Number of color map entries required. Set to zero for 'all' 54+4n ? This potion of the bitmap contains color map data, if required. For each color map entry, four bytes are required: 1st byte: Blue color data, 0-255 2nd byte: Green color data, 0-255 3rd byte: Red color data, 0-255 4th byte: Reserved, must be zero ? ? The remainder of the bitmap file contains the pixel data itself: 1bit bitmaps: Every bit corresponds to a color in the color map. The color map will have two entries. 2bit bitmaps: Every 2 bits correspond to a color in the map. The color map will have four entries. 4bit bitmaps: Every 4 bits correspond to a color in the map. The color map will have 16 entries. 8bit bitmaps: Each byte corresponds to a color in the map. The color map will have 256 entries. 16bit bitmaps: First 5bits encode blue, next 5bits encode green, and the final 5bits encode red. The 16th bit is ignored. No color map entries are needed. 24bit bitmaps: First byte encodes blue, second encodes green, and the third byte encodes red. No color map. 32bit bitmaps: Same as 24bit bitmaps, with the 4th byte unused.