lnf.cymru stimulus sheet · Computer Science · Year 7
The app, the school and the pupils on this sheet are invented. The way computers store pictures as numbers is real.
Year 7 at Ysgol Glanrhedyn are designing icons for Gwennol, a homework app. Their teacher, Mrs Jenkins, says: “A computer cannot store a picture. It can only store numbers. Every icon has to become a list of 0s and 1s.” Nia and Harri have drawn some icons. Your job is to turn pictures into numbers, numbers back into pictures, and work out how much space each icon needs.
A screen picture is made of tiny squares called pixels. The Gwennol icons are 8 pixels wide and 8 pixels high. The number of pixels is like the area of a rectangle: width × height.
A bit is a single 0 or 1. With 1 bit per pixel, 1 = black ■ and 0 = white □. Each row of the icon becomes 8 bits.
| Bits per pixel | Number of colours | Why |
|---|---|---|
| 1 | 2 | 0 or 1 |
| 2 | 4 | 00, 01, 10, 11 |
| 3 | 8 | 000 up to 111 |
| 4 | 16 | Each extra bit doubles the number of colours. |
| Code | 00 | 01 | 10 | 11 |
|---|---|---|---|---|
| Colour | White (W) | Yellow (Y) | Green (G) | Orange (O) |
Instead of writing every pixel, count how many of the same colour come in a run. W means white and B means black.
| □ | □ | □ | □ | □ | □ | □ | □ |
| □ | ■ | ■ | □ | □ | ■ | ■ | □ |
| ■ | ■ | ■ | ■ | ■ | ■ | ■ | ■ |
| ■ | ■ | ■ | ■ | ■ | ■ | ■ | ■ |
| □ | ■ | ■ | ■ | ■ | ■ | ■ | □ |
| □ | □ | ■ | ■ | ■ | ■ | □ | □ |
| □ | □ | □ | ■ | ■ | □ | □ | □ |
| □ | □ | □ | □ | □ | □ | □ | □ |