A bitmap image is made up of small dots called pixels (short for picture elements). Each pixel has a colour and a location, and they are arranged in a grid (called the raster). The pixel is the smallest part of an image that can be stored and displayed by the computer. When displayed together in the proper arrangement, these pixels form an image.
Each pixel’s colour is stored using the intensity (i.e. brightness) value for three channels, which correspond with the three primary colours of light: red, green, and blue. Any colour can be made by mixing these three colours in differing intensities. This colour encoding scheme is known as RGB.
The most common standard is to use 8 bits to give us a range of 0-255 for each of the red, green, and blue values. This means that we require 24 bits per pixel. This can be seen in the colour picker included in software such as Microsoft Office:
An RGB value of 0, 0, 0 would correspond to black, and a value of 255, 255, 255 would be white.
To encode an entire image in binary, the RGB values for each pixel are converted to binary, and stored together in the order that they will be displayed, starting with the top-left pixel row by row until the entire image has been stored.
Before we move on, it’s worth covering the key terms used in bitmap images:
- Pixel: Short for picture element, the smallest addressable part of a bitmap image. It has a colour, which is encoded in binary, and a location, which is determined by its order in the bitmap file (i.e. the first pixel in the bitmap file is displayed in the top-left of the image, and the last pixel is displayed in the bottom-right).
- Bitmap graphic: A digital image made up of rows of pixels, displayed together in the correct order.
- Colour depth: The number of possible colours that could be assigned to a pixel in the image. Colour depth is expressed in terms of either the number of bits per pixel, or the number of colours in the palette. A higher colour depth results in a higher quality image where the pixels are encoded with colours very close to the original image. Lower colour depth will reduce the image quality, with noticeable bands of colour where similar colours in the original image have been assigned the same colour during the encoding process, but the image will require less storage.
- Bitmap header: An area at the start of a bitmap file containing the height and width of the image (in pixels), the colour depth, and a declaration that the image is a bitmap image (rather than a different file format).
- Image resolution: The width and height of the image, measured in pixels (e.g. 1024 x 768). Higher resolution images contain more data and are sharper and/or can be displayed at a larger size. Lower resolution images require less storage but at a lower quality.
- Screen resolution: The number of physical pixels available in a display. This can refer to one of two standards:
- Total number of pixels: In these cases, the resolution is expressed as the width in pixels and the height in pixels. For example, a Full HD screen is 1960 x 1080 pixels.
- Sharpness: In these cases, the resolution will be expressed in terms of the number of pixels per inch (PPI). Larger numbers of pixels per inch result in a sharper image that can display more fine detail. Lower PPI values result in a screen with visible divisions between pixels and a less sharp image.
The most common colour depths
There are many colour depth standards available. Here are the ones you should learn as a starting point:
- 1-bit (monochrome): Two colours (normally black and white) are available
- 4-bit: Sixteen colours (most games in the ‘80s used 4-bit graphics)
- 8-bit: 256 colours (most PC games in the early ‘90s)
- 16-bit: 65536 colours
- 24-bit: 16.7 million colours
- 32-bit: 16.7 million colours, plus an 8-bit value for transparency
It’s worth noting that colour depth can be expressed in any number of colours, or in any number of bits. For example, a 13-colour bitmap image will require 4 bits per pixel (as this is the minimum number of bits required to store one of 13 distinct values). While these don’t come up in the real world any more, questions have appeared in past papers using arbitrary colour depths. As always, read the question carefully.
Estimating the file size of a bitmap
The file size of a bitmap image can be estimated using the following calculation:
FILE SIZE = IMAGE WIDTH × IMAGE HEIGHT × COLOUR DEPTH IN BYTES
Be careful: colour depth is generally expressed in bits, but the calculation requires you to convert the colour depth to bytes first. A monochrome image uses only 1/8th byte per pixel. If you fail to account for this, you will get the wrong answer.
Properties of bitmap editing software
Bitmap graphics packages provide tools that are tailored to the capabilities of the image format, including adjustments for brightness and contrast, colour correction, sharpen/soften, background removal tools, and filters (e.g. sepia tone and blur).