GoalExplain how a picture becomes pixels and bits, and work out how many bits a black-and-white picture needs.
New words
bit · a binary digit, which is 0 or 1pixel · a tiny square of a picture; short for ‘picture element’bitmap · a picture stored as a grid of pixels, each with its own bitscolour depth · the number of bits used for each pixel
Explanation
All data in a computer is stored in binary. Binary uses only two digits, 0 and 1, and each one is a bit. An old film photo is analogue, so it must be turned into digital data first. A scanner or a camera divides the picture into a grid of tiny squares called pixels. Each pixel is stored with bits. A picture with only black and white needs one bit for each pixel: 1 for black and 0 for white. We say its colour depth is 1. To find the size of a bitmap, multiply the pixels across by the pixels down, then multiply by the colour depth. A picture with more pixels has a higher resolution, so it looks sharper but needs more bits.
Worked examples
Pixels across
Pixels down
Colour depth
Bits needed
7
8
1
56
This tree is 7 pixels wide and 8 pixels high. It uses black (1) and white (0), so the colour depth is 1. The file size is 7 × 8 × 1 = 56 bits.
Picture
Across × down
Calculation
Bits
small
8 × 8
8 × 8 × 1
64
medium
16 × 16
16 × 16 × 1
256
large
32 × 32
32 × 32 × 1
1024
Resolution changes the size. A larger grid has more pixels and needs more bits. The table shows three black-and-white pictures.
Printed photo→Camera or scanner→Divided into pixels→Each pixel stored as bits
An analogue photo becomes digital in a few steps. First it is input with a scanner or camera. Then it is divided into pixels. Each pixel is given bits, and the bits are saved as a file.
Class activity
Pixel paper (no computer): on squared paper draw a grid 6 squares across and 6 down. Colour some squares black to make a letter or a simple shape. Write 1 under every black square and 0 under every white square, row by row. Work out the number of bits: across × down × 1. Give only your numbers to a partner, who has to draw your picture from the 1s and 0s. Check whether the picture is the same. If you have a computer or tablet, an adult can help you zoom right in on a photo until the pixels appear.
Practice
1
What letter do these codes make? Black is 1.
Row
Code
1
10001
2
10001
3
11111
4
10001
5
10001
Drawing the 1s as black squares gives the letter H.
2
A black-and-white picture is 12 pixels across and 9 pixels down. How many bits does it need?
12 × 9 × 1 = 108 bits.
3
The code of row 6 of the boat is hidden. Read the squares of that row (black is 1) and write the code.
Every square in row 6 is black, so the code is 11111111.
4
Picture A is 10 × 10 pixels and picture B is 20 × 20 pixels, both with colour depth 1. How many bits does each use? How many times bigger is B?
A: 10 × 10 × 1 = 100 bits. B: 20 × 20 × 1 = 400 bits. B needs 4 times as many bits, because it has 4 times as many pixels.