From Hill2dot0
(Redirected from BMP)
Jump to: navigation, search

Bitmap (BMP) is a format for storing and displaying graphic images. It is largely associated with Microsoft, although the concept of a bitmap occurs in other contexts as well.

Bitmaps and Resolution

To understand a bitmap, you need to understand how an image is rendered digitally. An image is a collection of picture elements, or pixels arranged (typically) in rows and columns. The number of rows or columns per inch describes the resolution of the image. An image with 2x2 resolution has two rows and two columns per inch. That means every pixel is .5 inches square. That may be adequate resolution for a billboard that will be seen yards away, but not for a computer screen that will be viewed up close.

In a bitmap, a number is assigned to each of the possible colors, and those numbers are stored or transmitted as is (without compression). To display the image, the device merely reads the bitmap and turns each pixel in each row and column to the indicated color. To correctly display the information, however, the system needs more information than just the bitmap itself. It also needs to know basic information about how the image is arranged and how the colors have been assigned. One critical piece of information is the dimension of the image. A 1000 x 1000 pixel image has the same number of pixels as a 500 x 2000 image, but it has a different number of rows and columns and they are of different lengths. If the display system doesn't know how to arrange the pixels on the screen, it cannot properly display the image.

In general, the bits are arranged in rows from top to bottom of the image, and the bits in each row are stored left to right. To correctly display the image, the receiver need only know the proper row length.

Bitmaps and Color Depth

Another important piece of information is the color depth. Where resolution is a measure of pixels per inch, color depth is a measure of color fidelity. In brief, it reflects how many colors are available for use. Color depth is typically binary (i.e., 2 colors, 4 colors, 8 colors, 16 colors, etc.) and the color depth impacts the size of the file that will store the image.

For example, with a color depth of two, usually the colors are black and white. A single bit can be used to indicate the color of a single pixel (e.g., 0 for black and 1 for white). A 1000 x 1000 pixel image will require 1 million bits to store. Since 1 bit equals 8 bytes, that means 125 kilobytes (kB) to store or transmit the image (ignoring other overhead).

With a color depth of four, however, we could have black, white, light gray, and dark gray. Now each color is represented by two bits (e.g., black = 00, white = 11, light gray = 01, and dark gray = 10). Now it will require two million bits to store or transmit the image, or 250 kB. The additional color information made the file larger. Obviously, the more colors and pixels we have to work with, the richer the image will be. But it will also come at a cost in image size.

Bitmaps and Color Palettes

Black and white may be simple enough, but as soon as you have a greater color depth, you have the question of exactly which color a particular code represents. This requires a color pallette, which is typically included along with the bit map. The color palette is nothing more than the set of acceptable codes and the specific colors each corresponds to. This requires, of course, a universally accepted way of describing color. Most bitmaps are based on the red green blue (RGB) system, where the color of pixel is reflected by the intensity of the three primary colors being combined to create the base color. Each color can have a value from 0 (least intense) to 255 (most intense). In the RGB model, if all three colors have 0 intensity (0,0,0), we have no light - so we have black. If they all have the 255 intensity, we have the the most light - so we have white. If the three colors have the same intensity (e.g., 100,100,100) we have a shade of gray. In RGB, 50,50,50 would be a darker gray than 100,100,100. Any other combination produces one of over 16 million possible shades of color. A simple color palette might be 00=0,0,0; 01=85,85,85; 10=170,170,170; 11=255,255,255. This would produce a greyscale image with the shades of gray.

Rather than provide the kind of explicit mapping suggested above, the color palette typically takes the form of a table of information conveyed at the beginning of the image file, and the color codes used in the bitmap simply indicate which part of the table to use. So the color palette above might simply be represented as:

Row 0: 000,000,000 - 085,085,085 Row 1: 170,170,170 - 255,255,255

Thus the code 00 means Row 0, Column 0 in the table, 01 means Row 0 Column 1 in the table, and so forth. Such an arrangement is called an indexed palette.

Strengths and Weaknesses of Bitmaps

There is no question that a bitmap provides the highest quality image if the resolution and color depth are adequate. However, it comes at a significant cost. And image that might require only 125 kB of information to store as a JPG or PNG image, both of which support compression, could take several megabytes to store and transmit as a BMP. BMP images are not considered Internet-friendly and are not typically used on web pages. They are more commonly found in system-level high-resolution graphics. For example, you can download BMP files for use as the background of your desktop. Some cameras can also be configured to store images in an uncompressed bitmap format.


<mp3></mp3> | Bitmap