KeyStage

Key Stage 3 computing · Data representation

KS3 images and sound in binary: pixels, samples and file size

In Key Stage 3 children find out that a picture or a piece of music on a screen is really a long list of numbers stored in binary. A picture is a grid of tiny coloured squares called pixels, and sound is a series of measurements of a sound wave taken many times a second. They learn how the choices made when capturing each, such as the number of pixels or how often sound is sampled, change the quality and the file size, and how those numbers can then be changed to edit the result.

Images and sound as binary, explained

The idea behind both topics is abstraction: keeping only the information that matters and storing it in a form a computer can handle. A picture in the real world has smoothly changing colour. To store it, the computer divides it into a grid of tiny squares called pixels and records one colour for each. Zoom in far enough on any digital photo and the squares appear. The number of pixels across and down is the resolution of the image. More pixels capture more detail but also take more storage.

Each pixel’s colour is a number stored in binary. The number of bits used for each pixel is the colour depth. A black and white image needs only one bit per pixel, since there are two choices, while two bits give four colours and three bits give eight. Each extra bit doubles the number of colours. Full-colour images commonly use 24 bits per pixel, usually 8 bits for each of red, green and blue, so each of those can range from 0 to 255 and mixing them makes millions of colours. The file size follows from this: width in pixels, multiplied by height, multiplied by bits per pixel, gives the size in bits, and dividing by 8 gives bytes. Real files also hold extra information, such as the width and height of the image, called metadata.

Sound is different, because the real thing is a continuous wave of air pressure. To store it, the computer measures the height of the wave at regular, very short intervals. Each measurement is called a sample, and the number taken each second is the sample rate, measured in hertz. A higher sample rate follows the shape of the wave more closely. The number of bits used to store each sample is the sample resolution or bit depth, and a larger value lets each measurement be more precise. Music is sampled tens of thousands of times a second, so even a short clip contains an enormous number of samples. Schools choose how far to go with calculations, but sample rate multiplied by bit depth multiplied by seconds gives the size of a mono recording in bits.

Because images and sound can be very large, children also meet compression. Lossless compression finds ways to store the same information in less space and the original can be rebuilt exactly. Lossy compression removes detail that people are less likely to notice, giving much smaller files but permanently losing some quality. Choices about resolution, colour depth, sample rate and lossy compression all trade quality against file size.

Once pictures and sound are numbers, they can be manipulated by changing numbers. Making an image brighter raises the values for each pixel, a filter applies a calculation to every pixel, and cropping or flipping rearranges them. In audio, making a sound louder increases the sample values, and trimming or reversing a clip reorders them. Children usually try this in editing software, then explain what the software is doing to the data. It is the same message as the rest of the topic: computers store everything as binary, and meaning comes from the rules for reading it.

Words your child will hear

Pixel
One tiny square of colour in a digital image; the word comes from ‘picture element’.
Resolution
The number of pixels in an image, usually given as width by height.
Colour depth
The number of bits used to store the colour of each pixel. More bits allow more colours.
Sample
One measurement of a sound wave at a moment in time.
Sample rate
How many samples are taken each second, measured in hertz.
Metadata
Extra information stored in a file about the data, such as image dimensions or the length of a recording.
Compression
Making a file smaller. Lossless keeps everything; lossy permanently drops some detail.

What the National Curriculum says

The programme of study for Key Stage 3 says:

  • Pupils should be taught to understand how instructions are stored and executed within a computer system; understand how data of various types (including text, sounds and pictures) can be represented and manipulated digitally, in the form of binary digits
  • Aim: pupils can understand and apply the fundamental principles and concepts of computer science, including abstraction, logic, algorithms and data representation.

Objectives from the National Curriculum in England, © Crown copyright, used under the Open Government Licence v3.0.

A worked example

An image is 40 pixels wide and 30 pixels high, and each pixel can be one of 8 colours. How many bytes does the image need, ignoring metadata? What happens if the image is changed to allow 16 colours?

  1. Find the bits needed for each pixel. 8 colours means 8 different patterns, and 2 × 2 × 2 = 8, so 3 bits per pixel are needed.
  2. Find the number of pixels: 40 × 30 = 1,200.
  3. Find the total bits: 1,200 pixels × 3 bits = 3,600 bits.
    40 × 30 = 1,200 pixels
    1,200 × 3 = 3,600 bits
    3,600 ÷ 8 = 450 bytes
  4. Change to bytes by dividing by 8, because 1 byte is 8 bits: 3,600 ÷ 8 = 450 bytes.
  5. For 16 colours, 2 × 2 × 2 × 2 = 16, so 4 bits per pixel are needed. 1,200 × 4 = 4,800 bits, and 4,800 ÷ 8 = 600 bytes. Doubling the number of colours added only one bit per pixel, but the file is a third bigger.
    1,200 × 4 = 4,800 bits
    4,800 ÷ 8 = 600 bytes

The image needs 450 bytes with 8 colours and 600 bytes with 16 colours.

Common mistakes and how to help

Believing that more pixels always means a better picture

Advertisements promote resolution as the main measure of quality, and enlarging a small image on screen makes it look bigger but not sharper.

What helps: Resolution is only the number of pixels captured. Stretching a small image cannot add detail that was never recorded. Compare a small photo enlarged on screen with one taken at a larger size.

Mixing up resolution and colour depth

Both are about image quality and both affect file size, so they get lumped together.

What helps: Resolution is how many pixels, colour depth is how many bits describe each pixel. Ask which would make a black and white diagram sharper and which would make a photo look more natural.

Mixing up sample rate and sample resolution in sound

Both have ‘sample’ in the name and both are numbers where bigger means better.

What helps: Sample rate is how often the wave is measured; sample resolution is how finely each measurement is recorded. Draw a wave, mark measurements and ask what changes if the dots are closer together, or if each dot can be placed more precisely.

Forgetting to divide by 8, or giving file sizes in bits when bytes are asked for

The calculation naturally ends in bits, and the final conversion is easy to skip.

What helps: Always write the unit after each line of working, and end by asking whether the question wants bits or bytes. Lines such as ‘3,600 bits ÷ 8 = 450 bytes’ make the step visible.

How to help at home

  • Colour in a pixel picture. Draw a grid of 8 by 8 squares on squared paper and make a simple picture with two colours, writing 1 for filled and 0 for empty. Then swap grids and see if your child can reconstruct the picture from the numbers alone.
  • Zoom right in. Take a photo on a phone and zoom in as far as you can until the squares show. Ask what would be lost if the picture was stored with fewer pixels, and what would be gained in file size.
  • Compare the same sound at different qualities. If a phone or computer offers more than one recording quality, record the same short sentence at each, then compare how they sound and how big the files are. Ask how many measurements would be needed to follow the sound wave more closely.
  • Check file sizes. Look at the size of a few photos, songs and videos on a device and compare them. Ask your child to guess why one is bigger and to name two ways to make a file smaller.

More on data representation

Everything in Key Stage 3 computing

Updated .