BMP file

BMP file is a bitmap file, which can be stored in compressed (lossless RLE) or not compressed form. For the written program data from the camera are stored in uncompressed BMP file for further processing by a graphical user interface (GUI). BMP file format generally consists of four parts:
  • file header (14 bytes)
  • bitmap header (40 bytes)
  • color palette (optional)
  • image data
BMP file lenght in bytes is calculated using the formula:

SH - header lenght, SH=54
SP - lenght of the color palette, SP=4*2n where n is the bit depth
SD - lenght of the image data, SD=(w*h*n)/8, where w and h are the width and height of the image in pixels
In used output camera format the value of each pixel is represented by 8 bits which means that the above formula is simplified to the form:
The color palette occurs only in 8-bit mode and below. For 8-bit mode, each color is represented by 4 bytes blocks - in sequence B,G,R and alpha(unused)
  Offset Size in bytes Description Settings
1 0000h 2 Header tag (BM, BA, CI, CP, IC, PT) "BM"
0002h 4 The lenght of the file in bytes 102454
0006h 4 Reserved bytes 0
000Ah 4 Data item from the beginning of the file 54
2 000Eh 4 Header lenght (40 for Windows) 40
0012h 4 Image width in pixels 352 (176)
0016h 4 Image height in pixels (if it's negative then the image is stored from top to bottom) 288 (144)
001Ah 2 Number of plans in the image 1
001Ch 2 The number of bit per pixel (1, 4, 8, 16, 24, 32) 8
001Eh 4 Compression algorithm:
"0" - no compression
"1" - 8 bit RLE
"2" - 4 bit RLE
0022h 4 Compressed picture size (bitmap) 0
0026h 4 Horizontal resolution (number of pixels per meter) 0
002Ah 4 Vertical resolution 0
002Eh 4 Number of colors in the palette 256
0032h 4 Number of important colors in the palette (used for bitmap animation)
"0" - all colors are important
Table 1. BMP file header