← IGCSE Computer Science Paper 1

Counting the pixels in an image

Total pixels = pixels per row times number of rows. For 1920 x 1080 that is 2,073,600 pixels. This is the first step when working out image file size.

Understanding Counting the pixels in an image in IGCSE Computer Science Paper 1

What it does: 800 pixels per row times 600 rows gives 480,000 pixels, which uses width times height. The total pixel count is calculated first and is then multiplied by the colour depth to find the file size in bits. 1920 * 1080 = 2,073,600. Adding them (1920 + 1080 = 3000) is a common mistake. Total pixels come first. The sample rate belongs to sound files, not images. 10 pixels per row * 4 rows = 40 pixels. 14 comes from adding instead of multiplying. 100 * 50 = 5,000 and 100 * 100 = 10,000. Changing the height changes the total pixels.

Common mistakes: The total was stored in a variable called pixels, but this line prints pixel, which does not exist. It should be print(pixels). A double equals sign compares two values. It does not store one. The width must be assigned with a single equals sign: width = 800.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 69–84) and word search (Modules 59–84).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
How do you work out the total number of pixels in an image?
width * heightwidth + height
Matches
pixels = width + height
↓
Width and height are added instead of multiplied. Adding gives only the pixels along two edges, not the total in the whole image. It should be width * height.
Applying
Meanings
Term
pixels = width * height
Meaning
Total pixels = pixels per row times number of rows. For 1920 x 1080 that is 2,073,600 pixels. This is the first step when working out image file size.
Practice
width ← 1920
Testing
Gaps
pixels = width height
Check Answer
Spots
3pixels = width * height
4print(pixel)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Platinum Fox' badge — Tundra Legend, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. How do you work out the total number of pixels in an image?
A. width * height ✓
B. width + height
Total pixels = pixels per row times number of rows, so you multiply the width by the height.
2. An image is 1920 x 1080 pixels. What is the total number of pixels?
A. 2,073,600 ✓
B. 3,000
1920 * 1080 = 2,073,600. Adding them (1920 + 1080 = 3000) is a common mistake.
3. Which one is the correct first step when calculating the file size of a bitmap image?
A. Find the total pixels: width * height ✓
B. Multiply by the sample rate
Total pixels come first. The sample rate belongs to sound files, not images.
4. An image is 10 pixels wide and 4 pixels high. How many pixels is it in total?
A. 14 pixels
B. 40 pixels ✓
10 pixels per row * 4 rows = 40 pixels. 14 comes from adding instead of multiplying.
5. In the image 1920 x 1080, what does 1920 stand for?
A. The number of rows (height)
B. The number of pixels in each row (width) ✓
In width x height notation, the first number is the pixels per row and the second is the number of rows.

Match the Pairs

pixels = width * height → Works out the total number of pixels in an image by multiplying the pixels per row by the number of rows
1920 * 1080 = 2073600 → A 1920 x 1080 image contains 2,073,600 pixels in total
The width is the number of pixels in each row, and the height is the number of rows, so multiply them to get the total pixels → total_pixels = 800 * 600
Counting the pixels is the first step before working out the file size of a bitmap image → file_size = total_pixels * colour_depth
pixels = width + height → Width and height are added instead of multiplied. Adding gives only the pixels along two edges, not the total in the whole image. It should be width * height.
1920 * 1080 = 3000 → The answer 3000 is just the two numbers added together (1920 + 1080). The product is 2,073,600 pixels.

Key Term

pixels = width * height
Total pixels = pixels per row times number of rows. For 1920 x 1080 that is 2,073,600 pixels. This is the first step when working out image file size.

Fill in the Blanks

1. pixels = width * height
Hint: Type the operator that multiplies the width by the height.
2. pixels = width * height
Hint: Type the variable name that stores the total number of pixels.
3. pixels = width * height
Hint: Type the variable for the number of pixels in each row.
4. pixels = width * height
Hint: Type the variable for the number of rows of pixels.
5. width = 1920 height = 1080 OUTPUT width * height
Hint: Type the variable that gives pixels per row in the calculation.

Spot the Error

Question 1
A width = 1920
B height = 1080
C pixels = width * height
D print(pixel)
Line D — The total was stored in a variable called pixels, but this line prints pixel, which does not exist. It should be print(pixels).
Question 2
A width == 800
B height = 600
C pixels = width * height
D print(pixels)
Line A — A double equals sign compares two values. It does not store one. The width must be assigned with a single equals sign: width = 800.
Question 3
A width = 1920
B height = 1080
C pixels = width + height
D print(pixels)
Line C — Total pixels is pixels per row times number of rows, so the values must be multiplied, not added. It should be pixels = width * height.
Question 4
A cols = 640
B rows = 480
C total = cols * cols
D print(total)
Line C — The width (pixels per row) is multiplied by itself, so the number of rows is never used. It should be total = cols * rows.
Question 5
A width = 1024
B heigth = 768
C pixels = width * height
D print(pixels)
Line B — The variable name is misspelled. Line 3 uses height, which would not exist, so the program would crash. It should be height = 768.

Student with a class code? Join your class →