.BMP or .DIB (device-independent bitmap) is a bitmapped graphics format used internally by the Microsoft Windows graphics subsystem (GDI), and used commonly as a simple graphics file format on that platform.
Images are generally stored with a color depth of 2 (1-bit), 16 (4-bit), 256 (8-bit), 65,536 (16-bit), or 16.7 million (24-bit) colors (the bits represent the bits per pixel). 8-bit images can also be greyscale instead of indexed color. An alpha channel (for transparency) may be stored in a separate file, where it is similar to a greyscale image. A 32-bit version with integrated alpha channel has been introduced with Windows XP and is used within its logon and theme system; it has yet to gain wide support in image editing software.
Depending on the color depth, a pixel in the picture will be stored using one or more bytes, which is determined by n/8 (n is the bit depth, since 1 byte equals 8 bits). The color of the pixel will be calculated (by the picture viewer, for example) based on the ASCII code of the bytes and the corresponding values read from the color palette. For more detailed information, see the section of bitmap file format below.
The approximate size for a n-bit (2n colors) bitmap in bytes can be calculated as:
size of BMP file , where height and width are given in pixels.
It should be noted that 54 in the above formula is the size of the header of the bitmap file. And is the size of the color palette. Notice that this is an approximation, as for a n-bit bitmap image, although there can be maximum colors, a specific image may not use all of these colors. Since the color palette only defines the colors that are used by the image, the actual size of the color palette will be smaller than .
For detailed information on how these values are derived, see the sections on file format below.
Due to storage algorithm, the calculated size will be slightly different from the actual file size, depending on several image parameters.
The following sections discuss the data stored in the bitmap file in details. Notice that this is the standard bitmap file format. Some bitmap images may be stored using a slightly different format, depending on the application that creates it. Also, not all fields are being used, and as such, a value of 0 will be found in these unused fields.
0 - none (also identified by BI_RGB) 1 - RLE 8-bit/pixel (also identified by BI_RLE8) 2 - RLE 4-bit/pixel (also identified by BI_RLE4) 3 - Bit field (also identified by BI_BITFIELDS) 4 - a JPEG image (also identified by BI_JPEG) 5 - a PNG image (also identified by BI_PNG)
However, since most BMP images are uncompressed, the most common value is 0.
A typical bitmap file uses the RGB color model. In this model, a color is created by mixing different intensities (which can vary from 0 to 255) of red (R), green (G) and blue (B). Or in other words, a color will be defined using its 3 values for R, G and B.
In the bitmap file implementation, the color palette contains many entries; the number of entries is the number of colors being used in the picture. Each entry contains 4 bytes: 3 for red, green and blue and the last one is unused (which will be filled with 0 by most applications). For each byte, a value of 0 indicates that the corresponding color (either red, green, or blue) is not used to create the current image color. On the contrary, a value of 255 indicates that maximum intensity is used.
The X Window System uses a similar .XBM format for true single-bit black and white images, and .XPM (pixelmap) for color images. There is also a .RAW format, which saves raw data with no other information. The Portable Pixmap file format (.PPM) and Truevision TGA (.TGA) formats also exist, but are rarely used - or only for special purposes. Yet other formats store as "bitmaps" (as opposed to vector graphics), but use compression or color indexes, and thus are not strictly considered true bitmaps.
Most BMP files compress very well with lossless data compression algorithms such as ZIP because they contain redundant data.
Graphics file formats | Microsoft Windows
BMP | BMP | Windows bitmap | Windows bitmap | Windows bitmap | BMP | BMP | Windows bitmap | BMP | BMP (bestandsindeling) | Windowsビットマップ | BMP | Device Independent Bitmap | BMP | BMP | BMP
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Windows bitmap".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world