GCSE · Computer Science · AQA · Spec 8525

Bitmap representation

Every photo on your phone is secretly a list of 0s and 1s: tiny squares of colour, each stored as a code. Let's turn a picture into 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 and watch each row turn 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

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 its colour depth (the readout calls it "bit depth"). Your challenge: repaint the second row so it would be stored as 11 00 00 11. Pick a swatch, tap pixels, and notice the Colours readout never moves: painting changes which code a pixel stores, not how many codes there are.

Your turn

Convert the colour A into binary, and back

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, then read one row of binary back into colours.

  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. Gut feeling: how many colours can a colour depth of 8 bits give? Slide to your guess, 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 one square of colour, the smallest part of the picture.
  • Each pixel's colour is stored as a binary number, so the whole image is just a list of codes, one per pixel.
  • A key says which code means which colour. Whoever stores the picture and whoever reads it must share that key.
  • Colour depth is the number of bits used to store each pixel's colour.
  • Number of colours = 2 to the power of the colour depth: 1 bit gives 2, 2 bits give 4, 8 bits give 256.
  • Have a goYour mate says a 7-bit colour depth gives 14 colours, "because each bit gives you two". Convinced?

    No. 2⁷ = 128 colours.

    Each extra bit doubles the colours rather than adding two: 2, 4, 8, 16, 32, 64, 128. Working out 7 × 2 is exactly the trap.

  • In one image every code is the same length, so at 2 bits white stays 00. That's how a reader finds where pixels end.
  • Have a goA 2-bit image uses the key 00 = white, 01 = red, 10 = blue, 11 = black. Which colours are stored in 1101?

    Black, then red (11 | 01).

    Cut the bits into 2-bit codes first. Reading them one bit at a time, as if the image were black and white, finds four pixels instead of two.

  • Image size is counted in pixels and written width × height: 10 × 8 means 80 pixels.
  • Have a goA tiny icon is 6 pixels wide and 4 pixels high. How many pixels does it have?

    24 pixels.

    Width × height: 6 × 4 = 24. Adding them to get 10 counts only one row and one column, not the whole grid.

  • Writing an image as binary? Go row by row, left to right, copying each pixel's code from the key.
  • Reading binary back? Split it into rows using the width, then into codes using the colour depth, then look each one up.
  • More colour depth buys more colours; more pixels buy more detail. Both cost more data to store.

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. It looks right because both are about colour, but 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 28 October 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.