Lossy compression of an image by reducing resolution or colour depth

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Lossy compression of an image by reducing resolution or colour depth

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. An image is compressed by halving both its width and its height (same colour depth). What happens to the number of pixels?
A It falls to half of the original
B It falls to one quarter of the original
2. Which of these is lossy compression of an image?
A Reducing the colour depth from 24 bits to 8 bits
B Storing 50 red pixels as the code 50R
3. A 100 x 50 image has a colour depth of 24 bits. It is reduced to 8 bits. What is the new file size?
A 100 x 50 x 8 = 40,000 bits
B 100 x 50 x 24 = 120,000 bits
4. A 24-bit image is reduced to 8-bit colour. The resolution stays the same. What happens to the file size?
A It becomes one third of the original
B It becomes two thirds of the original
5. A 40 x 20 image with 8-bit colour depth has its width and height halved. What is the new size?
A 20 x 10 x 4 = 800 bits
B 20 x 10 x 8 = 1,600 bits

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1size = 800 * 600 * 24 AThe size in bits of the original image: width x height x colour depth, before any lossy compression.
2size = 400 * 300 * 24 BThe student multiplied by both colour depths. After reducing from 24 bits to 8 bits, only the new depth of 8 should be used, not both.
3Lossy compression can reduce the colour depth from 24 bits to 8 bits, so each pixel needs a third of the bits. Csaving = before - after
4Work out the saving by subtracting the size after compression from the size before. DThe student halved the width and height but then also divided by 2. Halving both dimensions gives a quarter, so the size is calculated twice over and the result is wrong.
5size = 400 * 300 * 24 / 2 Esize = width * height * 8
6size = 800 * 600 * 8 * 24 FThe size in bits after the width and height are both halved, which is one quarter of the original size.

Definitions

lossy image compression

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
newWidth ← _____ / 2 newHeight ← height / 2
2.
newWidth ← width / 2 newHeight ← height _ 2
3.
depthBefore ← 24 depthAfter ← _ // 256 colours
4.
sizeBefore ← 800 * 600 * 24 sizeAfter ← 400 * 300 * 24 saved ← sizeBefore _ sizeAfter
5.
newDepth ← 8 sizeAfter ← newWidth * newHeight * ________

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A w = 800
B new_w = w * 2
C h = 600
D new_h = h // 2
Question 2
A w = 400
B h = 300
C pixels = w + h
D after = pixels * 8
Question 3
A pixels = 400 * 300
B old_depth = 24
C new_depth = 8
D after = pixels * old_depth
Question 4
A new_depth = 8
B colours = new_depth ** 2
C print(colours)
Question 5
A before = 800 * 600 + 24
B after = 400 * 300 * 24
C saved = before - after

Answer Key

Lossy compression of an image by reducing resolution or colour depth
Section A: Quick Questions
Q1
B — It falls to one quarter of the original
Q2
A — Reducing the colour depth from 24 bits to 8 bits
Q3
A — 100 x 50 x 8 = 40,000 bits
Q4
A — It becomes one third of the original
Q5
B — 20 x 10 x 8 = 1,600 bits
Section B: Match the Pairs
Q1
size = 800 * 600 * 24 → The size in bits of the original image: width x height x colour depth, before any lossy compression.
Q2
size = 400 * 300 * 24 → The size in bits after the width and height are both halved, which is one quarter of the original size.
Q3
Lossy compression can reduce the colour depth from 24 bits to 8 bits, so each pixel needs a third of the bits. → size = width * height * 8
Q4
Work out the saving by subtracting the size after compression from the size before. → saving = before - after
Q5
size = 400 * 300 * 24 / 2 → The student halved the width and height but then also divided by 2. Halving both dimensions gives a quarter, so the size is calculated twice over and the result is wrong.
Q6
size = 800 * 600 * 8 * 24 → The student multiplied by both colour depths. After reducing from 24 bits to 8 bits, only the new depth of 8 should be used, not both.
Section C: Definitions
Q1
lossy image compression — Reduces an image's resolution or colour depth to shrink the file. Detail is lost for good. Recalculate width x height x depth to see the saving.
Section D: Fill in the Blanks
Q1
newWidth ← width / 2 newHeight ← height / 2
Q2
newWidth ← width / 2 newHeight ← height / 2
Q3
depthBefore ← 24 depthAfter ← 8 // 256 colours
Q4
sizeBefore ← 800 * 600 * 24 sizeAfter ← 400 * 300 * 24 saved ← sizeBefore - sizeAfter
Q5
newDepth ← 8 sizeAfter ← newWidth * newHeight * newDepth
Section E: Spot the Error
Q1
B — Lossy compression halves the width, so the new width is w // 2 (400). Multiplying by 2 would make the image wider and bigger, not smaller.
Q2
C — The number of pixels is width multiplied by height (w * h), not added. Adding would give only 700 pixels instead of 120000.
Q3
D — The size after compression must use the new, reduced colour depth (8 bits). Using the old depth of 24 would give the size before compression.
Q4
B — The number of colours is 2 to the power of the colour depth: 2 ** new_depth = 256. The base and the power were swapped, which gives 64.
Q5
A — Image size in bits is width x height x colour depth, so all three values are multiplied. The + should be *.