BMP

This graphics format is used by the operating system Microsoft Windows.
Originally, it was intended for 16 color images. It supports only simple compression.
This is because it is used frequently, and a long compression would slow down significantly
the speed of the whole system. Therefore, the format is simple and fast.
A negative feature is large size of the image.

ColorsUsed
Specifies the current number of colors in the pallet.
If the value = 0, then the bitmap uses all colors from the color table.

36

4

ColorsImportant
Specifies how many colors are important for displaying an image.
If the value = 0, then all colors are important.

BitPerPixle It can have these values:

1

Here the bitmap is monochromatic, comprising of two values.
Every bit in the bitmap field represents one pixel. If the bit is empty,
the pixel is displayed with the color of the first value in the
Color Table.
If the bit is full, then the pixel has the color of the second value in the Color Table.

4

The bitmap has maximally 16 colors.
Each pixel in the bitmap is represented by a 4-bit index from the Color Table.
For instance, if the first byte in the bitmap is 1Fh, it represents two pixels.
The first pixel is displayed with the color number 2, and the second one with
the color number 16.

8

The bitmap has maximally 256 colors. Each pixel of the bitmap is represented by 1-byte,
specifying the number of the pixel. For instance, if the first in the bitmap is 1Fh, then the first
pixel has the color number 32 of the Color Table.

24

The bitmap has maximally 2^24 colors. The bmiColor (or bmciColor) member is NULL,
and each 3-byte sequence in the map array represents the relative intensities of
red, green, and blue, respectively, for a pixel

Pallet of colors

This defines the array ? RGB structure ? comprising colors used in the bitmap.
Color in the table area is arranged with growing importance. This is advantageous if the display device
is not capable of displaying all the colors used in the bitmap. The pallet of a BMP image has the size
of the number of colors * 4 bytes. The pallet has meaning if the value of the BitPerPixle is either
1, 4, or 8. In using 24-bits per pixel, the color is stored directly in data as a sequence of values of
individual color components RGB. So, for instance, data 10, 60, 30 mean that red is 10, green is 60,
blue is 30. For one dot or pixel it is necessary to store always 4 bytes. Because in the pallet there is
stored also 1 byte more, for 256 colors it is necessary to store 1024 bytes instead of 786 bytes.

This is set in accordance with the header and the color table. The data, immediately following after the color table,
comprise the array of bytes representing the sequence of a line of the bitmap (scanline).
Each scanline contains a sequence of bytes representing a series of pixels in the scanline,
in the order from left to right. The size of bits representing the scanline depth of color format and
idth in pixels of the bitmap. If it is necessary, the scan line must null the unused empty bits up to the
32-bit edge. But, the segment of the edge can occur anywhere in the bitmap. The scan lines in the bitmap
are stored from bottom to top. This means that the first byte in the array represents the pixel in the bottom
left edge of the bitmap, and the last represents the pixel in the top right edge.

CompressionMethod

Windows version 3.0 and higher support the run-length encoded (RLE)
format for the compression of the bitmap, using 4 bits per pixel or 8 bits per pixel.
This compression reduces the size of resulting bitmap.
Value 0 BI_RGB - the bitmap is not compressed?

The image is stored in a non-coded state and is directly displayable.
For 1-bit images, there are in one byte stored 8 points (1 bit = 1 point).
For 4-bit images, there are stored in one byte 2 points. Four bits represent the value: 0-15,
which specifies the index of a color from the pallet. For 8-bit images (meaning 256-color images)
it is the value 0-255, which specifies the color index of the pallet. A special case are 24-bit images,
when one point requires 4 bytes. Each point takes up 4 bytes in the file, where the first three bytes
specify the ratio of red, green and blue components in the resulting color, and one byte is empty.
Each of the components represents the intensity of the given color from 0-255.