Windows bitmap
See also: BMP
Bitmap , known also under its Acronym BMP , is a open format of Digital image developed by Microsoft and IBM. It is one of the formats of the images simplest to develop and use to program. It is readable by almost all the visualiseurs and editors of images.
It is about matric images
Organization of the file
The file cuts out in 3 zones:- the heading of the file;
- the palette;
- relative data with the image.
Heading of the file
It cuts out in 2 parts, namely:- relative data with the file;
- relative data with the image.
One finds in particular the size of the file in bytes, the site of beginning of the data, the number of bits by pixels in the image, the type of compression used, the number of colors in the pallet, the width and the length of the image, etc
Pallets
The software of reading uses three bytes to code the color (system Rouge blue green, RVB):
- in BMP 24 bits (1 red byte, 1 green byte, 1 blue byte by pixel), the pallet is not necessary (one can represent all the colors);
- in BMP 8 bits, one can represent only 256 colors, it is necessary to define a correspondence between the color of the pixel and the 3 components. It thus was added a table right after the heading (byte 56), which gives for each value (of 0 has 255) the three components RVB which correspond to it).
For example, for an image in levels of gray (256 nuances), the three values R, V and B will be equal and vary between 0 and 255.
file BMP of a file thus becomes:
- heading
- pallet with byte 56 (38 into hexadecimal);
- image with the byte: 1078 (0436 into hexadecimal);
Many colors
This format supports several alternatives, according to the many desired possible colors. The depth of colors is the number of bits associated with each Pixel to code the Couleur of it.
Thus, images BMP can be in 2 colors (1 bit), 16 colors (4 bits), 256 colors (8 bits), 65.536 colors (16 bits) or 16,8 million colors (24 bits).
The images 24 bits have 3 channels of 8 bits for the three primary lights (red, green, blue) which can take each one 256 different values. The images in 256 levels of gray are possible with 1 only channel of 8 bits.
Cut file
Format BMP is almost non-existent on the Web: it does not degrade the image and generally does not use compression, also is it very heavy. There exists nevertheless compression RLE for format BMP.
To calculate the approximate size of final file BMP, one multiplies the depth colors (1, 4,8,16 or 24 bits) by the height and the width in pixels: (Depth of colors out of bits) × (Height in pixels) × (Width in pixels) bits.
For example, an image in 800x600 (800 Pixel S broad by 600 pixels top) of 24 bits (16,8 million colors) will have a size of (800 × 600 × 24) bits is 1,4 Mo or the size of the Disquette S 3" 1/2 high density.
Data layout of the image
Contrary to the majority of the formats of images, the pixels of the image are coded on the basis of the lower line of the image. Each line (coded from left to right) must always occupy a multiple number of bytes of 4, except if the image is compressed. If the line does not have a multiple number of bytes of 4, one fills the line while adding of the zeros.
If the image is coded of 24 bits, each pixel is coded by an entirety 24 bits (RVB), order little-endian , i.e. the three bytes code successively the levels of blue, green and red.
If the image is coded with less than 24 bits, each pixel is coded in the shape of an index in the table of colors (the pallet), from where name " image indexée". In the case of the images coding the pixels on 1 bit or 4 bits, i.e. if several pixels are coded in the same byte, the bits of strong weight relate to the pixel on the left.
Compression
Format BMP allows the use of the algorithm of compression RLE for the images 8 bits (256 colors) and 4 bits (16 colors).
Compression is seldom proposed by the current design software because it is not supported nativement by the versions of Windows former to Windows XP.
The principle:
- a byte ranging between 1 and 255 indicates the number of pixels for which it is necessary to use the contained information in the following byte;
- a byte with 0 indicates a special action, it is followed of a second byte:
- If it is worth 0, the end of line is reached, to pass to the following line;
- If it is worth 1, the end of the image is reached, fine reading;
- If it is worth 2, to jump X columns and Y lines before continuing ( X and Y each one being coded on 1 byte);
- If it is worth between 3 and 255, it acts of the number of pixels which follow, coded like not compressed data. In this case, it is possibly necessary to jump an unutilised byte so that the number of bytes is even.
See too
Internal bonds
External bond
- Details of format BMP
| Random links: | Lee Chang-Ho | The Tour of the sea Érythrée | Södermalm | Saint-George Gingerland | Sewers of the paradise | 3_Juno |