AQA Computer Science 8525Topic 3.3 — Fundamentals of data representationFoundation & Higher
Everything a computer stores is a pattern of ones and zeros. This topic is about how the same binary building blocks are arranged to hold numbers, text, pictures, sound and compressed data, and how you work backwards from what is stored to what it means. It is the most calculation-heavy part of Paper 2, and the calculations are all variations on the same two ideas: count the bits, and read the pattern.
What you need to know
What a pixel is
Understand what a pixel is and be able to describe how pixels relate to an image and the way images are displayed. The term pixel is short for picture element, and a pixel is a single point in an image. A photograph on a screen is a grid of these points, each showing one colour.
Key fact: A pixel is a single point in an image, and an image is a grid of them.
Image size
The size of a bitmap image is measured in pixels, written as width x height — so 800 x 600 is an image 800 pixels wide and 600 pixels tall. It is the number of pixels, not the physical size on screen, that determines how much data the image needs.
Key fact: Image size is width x height in pixels, for example 800 x 600.
Colour depth
Colour depth is the number of bits used to represent each pixel. With 1 bit per pixel each pixel is black or white. With 8 bits you get 256 colours. With 24 bits, the usual for photographs, each pixel has 8 bits for red, 8 for green and 8 for blue. The more bits, the more colours and the more data.
Key fact: Colour depth is the number of bits per pixel: 1 bit gives 2 colours, 8 bits gives 256, 24 bits gives 16.7 million.
Calculating the file size
Calculate bitmap image file sizes based on the number of pixels and colour depth. Size in bits = W x H x D. Size in bytes = (W x H x D) / 8. W is the image width, H is the height and D is the colour depth in bits. So a 100 x 100 image at 24 bits per pixel needs 100 x 100 x 24 = 240,000 bits, which is 30,000 bytes.
Key fact: Size in bytes = (width x height x colour depth) / 8.
What changes the file size
Describe using examples how the number of pixels and the colour depth affect the file size. Doubling the width and height makes four times as many pixels, so four times the file size. Doubling the colour depth doubles the file size. A phone camera at 4000 x 3000 with 24-bit colour needs 4000 x 3000 x 24 / 8 = 36,000,000 bytes, about 36 MB, for a single photograph.
Key fact: Doubling width and height quadruples the size; doubling the colour depth doubles it.
Converting in both directions
Convert binary data into a bitmap image by drawing the resulting image as a series of pixels, and convert a bitmap image into binary data by writing down the bit pattern that represents the image. With a colour depth of 1 bit, each row of the pattern is a run of 0s and 1s; with more bits, each pixel takes that many bits. The specification's run length example, 0000011100000011, is one row of a 1-bit image.
Key fact: You must be able to read a bit pattern as a picture and write a picture as a bit pattern.
Flashcards
What does pixel stand for?
Picture element — a single point in an image.
How is the size of a bitmap image expressed?
Width x height in pixels, for example 800 x 600.
What is colour depth?
The number of bits used to represent each pixel.
How many colours can 1 bit per pixel represent?
2, so black and white.
What is the formula for the size of a bitmap in bytes?
(width x height x colour depth) / 8.
What happens to the file size if the width and height are both doubled?
It becomes four times larger, because there are four times as many pixels.
How many colours does 24-bit colour give?
2²⁴, which is 16,777,216 — usually described as 16.7 million.
Exam questions
Written in the style of AQA Computer Science, with a mark scheme for each one. No question here is a real past paper question.
mcq1 mark
An image is 200 x 150 pixels and uses 24 bits per pixel. What is its file size in bytes?
90,000 bytes
4,500 bytes
7,200 bytes
750 bytes
Mark scheme: 1 mark for 90,000 bytes. The image has 200 x 150 = 30,000 pixels, so it needs 30,000 x 24 = 720,000 bits, which is 720,000 / 8 = 90,000 bytes.
calc3 marks
A bitmap image is 400 pixels wide and 300 pixels high, with a colour depth of 8 bits. Calculate the size of the image in bytes.
Answer: 90,000 bytes (400 x 300 x 8 = 960,000 bits, and 960,000 / 8 = 90,000 bytes).
six6 marks
Explain in English how a bitmap image is stored, and how the size of the image and the colour depth affect the file size.
Mark scheme: Level 1 (1-2 marks): A short answer saying an image is a grid of pixels and each pixel takes a set number of bits. Level 2 (3-4 marks): A structured answer covering size, colour depth and the file size formula. Level 3 (5-6 marks): A detailed answer explaining that a pixel is a single point and an image is a grid of them, explaining that size is width x height in pixels and colour depth is the bits per pixel, giving the formula size in bytes = (W x H x D) / 8 with a worked example, explaining that doubling width and height quadruples the data while doubling the colour depth doubles it, and explaining how a binary pattern can be drawn as a picture and a picture written as a binary pattern.