GCSE · Computer Science · AQA · Spec 8525

Bitmap representation

Every picture on a screen is made of tiny squares of colour, and each square can be stored as 0s and 1s. Here's how a picture becomes binary and back.

Bitmap images

Store a letter A as 0s and 1s

This tiny picture is 4 pixels wide and 4 pixels high. A pixel is one square of colour, the smallest part of the picture. In the listing, # is a black pixel and . is a white one. Step through to turn each row into binary.

Predict before you get there: every pixel in row 3 is black. What will its binary be?

1 KEY
2 . white → 0
3 # black → 1
4
5 . # # .
6 # . . #
7 # # # #
8 # . . #
rowbinary
key1 bit each

Output

 

Step 1: First, agree a key: white is 0 and black is 1. The key is a choice, but whoever stores the picture and whoever reads it must use the same one. Two colours need only two codes, so each pixel needs just 1 bit.

1 / 5

Press Next to convert one row at a time. The binary builds up in the Output box.

Step 1 of 5: First, agree a key: white is 0 and black is 1. The key is a choice, but whoever stores the picture and whoever reads it must use the same one. Two colours need only two codes, so each pixel needs just 1 bit..

Colour depth

Want four colours? Give each pixel two bits

4 × 4 pixels · 2-bit

4 by 4 pixel grid, 2 bits per pixel, 4 colours

Paint
Colours4Bit depth2-bit
Key: 00 white · 01 red · 10 blue · 11 black

The same A, now in colour. Four colours need four codes, and two bits give exactly four: 00, 01, 10 and 11. The number of bits each pixel gets is called the colour depth (the readout says "bit depth"). Choose a swatch, then tap pixels to repaint the A: whatever you paint, every pixel stores one of those four codes.

Your turn

Convert the colour A into binary

The colour A uses 2 bits per pixel with the key 00 = white, 01 = red, 10 = blue, 11 = black. Row 1 is white, red, red, white. Row 3 is red, blue, blue, red. Write each row in binary.

  1. The colour depth is 2 bits, so every pixel gets exactly two bits: no more, no fewer.
  2. missing step
Which line is step 2?

Scale it up

How many colours can 8 bits make?

1 bit per pixel gave 2 colours. 2 bits gave 4. How many colours can a colour depth of 8 bits give? Slide to your estimate, then lock it in.

Your estimate

152 colours

0 colours300 colours

Check your thinking

What does colour depth actually count?

Sam says: "My image has a colour depth of 5, so it can show 5 colours."

Which is closest to what you think?
How sure are you?

Trade-offs

What does each change buy, and what does it cost?

For each change to an image, tick every effect it has. Assume nothing else about the image changes.

Increase the colour depth (e.g. 4 bits → 8 bits)
Increase the width and height in pixels
Decrease the colour depth (e.g. 8 bits → 4 bits)

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

How a picture becomes a list of 0s and 1s, and how that list becomes a picture again.

What you need to know

  • A bitmap image is a grid of pixels. A pixel is a single square of colour, the smallest part of the image.
  • Each pixel's colour is stored as a binary code, and a key says which code stands for which colour.
  • Colour depth is the number of bits used for each pixel. Number of colours = 2 to the power of the colour depth.
  • Image size is measured in pixels, written width × height.

The big picture

A bitmap image is a grid of pixels, and each pixel's colour is stored as a binary code looked up in a key. Colour depth is the number of bits per pixel, and the number of colours available is 2 to the power of the colour depth. More colour depth gives more colours and more pixels allow finer detail, but both mean more data to store.

Key points

1To turn an image into binary, work row by row, left to right, writing each pixel's code from the key.
2To turn binary back into an image, split the data into rows using the width, split each row into codes using the colour depth, then look each code up in the key.
3A black-and-white image needs only 1 bit per pixel: two codes, 0 and 1, for two colours.
4Each extra bit of colour depth doubles the number of colours: 1 bit gives 2, 2 bits give 4, 8 bits give 256.
5Greater colour depth gives more colours; more pixels allow finer detail. Both mean more data to store.

Worked example

Problem

A black-and-white bitmap image is 3 pixels wide and 3 pixels high. It uses the key 0 = white, 1 = black. Its data is 010111010. Draw the image.

⚠ Watch out

Treating colour depth as the number of colours. A colour depth of 3 means 3 bits per pixel, which gives 2³ = 8 colours, not 3.

🧠

Memory hook

Colour depth is the length of each pixel's code, not the size of the paintbox. The paintbox holds 2 to the power of that length: 1 bit, 2 paints; 2 bits, 4 paints; 3 bits, 8 paints.

✓

Check yourself

Cover the page. What does colour depth measure? How many colours does a 2-bit colour depth allow, and what are its four codes? Does doubling an image's width and height give it more colours?

Flashcards

(13)
What is a pixel?
A single square of colour: the smallest part of a bitmap image.
What is a bitmap image?
A grid of pixels, where each pixel's colour is stored as a binary code.
What is colour depth?
The number of bits used to store the colour of each pixel.
How do you work out the number of colours from the colour depth?
2 to the power of the colour depth. A depth of n bits gives 2ⁿ colours.
Why does a black-and-white image need only 1 bit per pixel?
Two colours need only two codes, and 1 bit gives exactly two: 0 and 1.
How many colours can a colour depth of 8 bits give?
256, because 2⁸ = 256.
What happens to the number of colours each time you add 1 bit to the colour depth?
It doubles: every old code can now end in 0 or in 1.
How is the size of a bitmap image measured?
In pixels, written width × height (across first, then down).
In a 2-bit image, why is white stored as 00 rather than 0?
Every pixel's code must be exactly 2 bits long, so the reader can tell where each pixel's code ends.
What does increasing an image's width and height in pixels do?
More pixels, so finer detail can be shown, and more data to store. The colours available stay the same.
What does increasing the colour depth do?
More colours available and a longer code for every pixel, so more data to store. The number of pixels stays the same.
What is the key for, in a bitmap image?
It says which binary code stands for which colour. Without the same key, the binary cannot be turned back into the same picture.
Reading binary back into an image: what tells you where each row ends?
The width in pixels. Each row holds width × colour depth bits.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 30 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.