AlbaCode
National 5 / Computer Systems / Bitmapped Graphics

Bitmapped Graphics

Learn one method computers use to store graphics

Introduction

There are two main methods of storing graphics:

  • Bitmap
  • Vector

Computer must store all data as binary. This includes images!

We will focus on the Bitmapped method of storing images.

Pixels

If you zoom into a photo close enough you will see that it is made up of many little squares, these are called pixels (Picture Element).

bird with pixels visible

A bitmapped graphic is a 2D grid of pixels.

Look at the black and white image below:

black and white bitmapped image

We can see in the image above that the computer stores the colour of each pixel in this grid by assigning it a binary value.

Since our image is black and white, we can store the colour of each pixel using either a 0 or a 1.

0 = black

1 = white

Colour Depth

If we add more colours to the image, we will need to use more bits for each pixel.

For example:

coloured bitmapped image

In the image above, each pixel requires 2 bits to store the colour. This is because we have 4 different colours in the image

00 = Blue

01 = Green

10 = Red

11 = Yellow

The number of bits used to store the colour of each pixel is known as the colour depth (or bit depth).

The colour depth tells us how many different colours an image can use.

The image above has a colour depth of 2. This means that we can store 4 different colours.

The black and white image in the previous example had a colour depth of 1. This means that the image can use 2 different colours.

The formula for working out the number of colours based on the colour depth is given below:

Number of colours = 2bits

Therefore:

Colour DepthFormulaNumber of Colours
1212
2224
828256
1621665,536
2422416,777,216

The higher the colour depth the more colours the image will be able to use. However, this also means that we require more bits to store the colour of each pixel and therefore the file size will increase.

Resolution

Resolution refers to the number of pixels in an image.

rectangle

The higher the resolution, the clearer the image will be! However, as we are then storing more pixels - the file size will increase.

One common way of measuring resolution is DPI (Dots Per Inch). This refers to how many pixels are contained within a square inch (approx. 2.5cm x 2.5cm).