Cover lesson · Computer Science · Year 7 · Beginner

Turning a pixel icon into numbers

LNF: Numeracy → Developing mathematical proficiency → Conceptual understanding

Name: Class: Date:

Cover teacher: you need no subject knowledge

What this practises: numeracy in Computer Science. Pupils see one idea, a picture stored as numbers, in several forms: a drawing, rows of bits, a colour code, a run-length code and a file size. They connect pixels to area, bits to doubling, and bits to bytes, and judge whether answers make sense. This builds towards GCSE Computer Science Unit 1, Section 1.2.1 (representing images and calculating file sizes).

Print: this sheet, one per pupil, and the stimulus sheet “The Gwennol app: icons made of numbers”, one between two. Pupils need a pencil. Coloured pencils are useful for Step 4 but not essential. No calculators and no computers.

Run: 5 min read sections 1 to 6 and do Step 1 · 8 min Step 2, decode the home icon · 8 min Step 3, encode the favourites icon · 8 min Step 4, the 4-colour icon · 10 min Step 5, file sizes · 7 min Step 6, run-length encoding · 4 min success criteria. Total 50 minutes.

Collect: this sheet. The worked example has every answer. Checkpoints: Icon A is a house with a door; an 8 by 8 icon with 1 bit per pixel is 64 bits = 8 bytes; Icon B takes 36 characters in run-length code instead of 64.

What you are doing

A computer stores every picture as numbers. Today you will show the same icon in five different ways: as a picture, as bits, as a colour code, as a run-length code and as a file size. Each way tells you something different.

Step 1: warm-up

QuestionAnswer
How many pixels are in an 8 by 8 icon? In a 16 by 16 icon?
How many bits are in 1 byte?
How many colours can you show with 1 bit? With 2 bits? With 3 bits?

Step 2: bits to picture

Icon A in section 7 is stored as 8 rows of bits. Shade a square for every 1 and leave it white for every 0. What is the picture?

The picture is: ______________________________

Step 3: picture to bits

Icon B in section 7 is a picture. Write each row as 8 bits (black = 1, white = 0).

RowBitsRowBits
15
26
37
48

Step 4: a colour icon

Icon C uses the Gwennol 4-colour code, 2 bits per pixel. Write the letter (W, Y, G or O) in each square, or colour it in.

(b) Icon C has 16 pixels. How many bits does it use altogether? Why is it not 16?

Step 5: how much space?

Use the formulas in section 5.

IconPixelsBits per pixelBitsBytes
8 by 8, 2 colours
8 by 8, 4 colours
8 by 8, 16 colours
16 by 16, 4 colours

(b) Harri makes his icon twice as wide and twice as high. He says the file will be twice as big. Is he right? Use your table to explain.

(c) Nia says, “I can show 3 colours with 1 bit per pixel.” Explain why she is wrong. What is the smallest number of bits per pixel she needs for 3 colours?

Step 6: run-length encoding

Write each row of Icon B as runs (see section 6). Count the characters.

RowRunsCharactersRowRuns and characters
15
26
37
48

(b) Total characters in run-length code: ______ compared with 64 bits. Which row is longer in run-length code than in bits? Why?

Step by step

  1. 5 min Read sections 1 to 6. Step 1 warm-up.
  2. 8 min Step 2: bits to picture.
  3. 8 min Step 3: picture to bits.
  4. 8 min Step 4: the colour icon.
  5. 10 min Step 5: how much space?
  6. 7 min Step 6: run-length encoding.
  7. 4 min Tick the success criteria you have met.

Success criteria

If you finish early