AS Level · Topic 1.2
A-Level Computer Science 9618 / Topic 1 / AS

Pixels or shapes?

A photo and a logo can look alike on screen, but they are stored in completely different ways. A bitmap records the colour of every pixel; a vector graphic records a list of shapes and their properties. Learn how each is encoded, estimate bitmap file sizes and justify which to use.

The key idea

A bitmap is a grid of pixels; each pixel stores a binary colour code. The colour depth (bit depth) is the number of bits per pixel, so it allows 2n colours. The image resolution is the number of pixels (width × height). A file header stores data about the image, such as its dimensions and colour depth. Estimated file size = width × height × colour depth bits. A vector graphic is a drawing list of drawing objects, each described by its properties, so it can be scaled without losing quality.

bitmap: a grid of pixels vector: a drawing list 6 × 6 pixels, each a colour code enlarge it and the steps show object: circle centre (250, 90) radius 40 line colour, width 2 fill colour properties describe the shape, so it is redrawn sharply at any size
Fig. 1: a bitmap stores every pixel; a vector stores objects and their properties
Section 01

How a bitmap is encoded.

In the lab, change the resolution and the colour depth of the image. Watch the picture quality and the file size change together.

Examiner trap

Do not confuse image resolution with screen resolution. Image resolution belongs to the file; screen resolution belongs to the display.

Section 02

Estimating file size.

The pixel data is width × height × colour depth bits. The header is small, so an estimate ignores it. Divide by 8 for bytes, then by 1024 for KiB and again for MiB.

Worked example Full HD photo
Estimate the file size of a 1920 × 1080 bitmap with a colour depth of 24 bits, in MiB.
  1. Number of pixels: 1920 × 1080 = 2 073 600.
  2. 24 bits = 3 bytes per pixel: 2 073 600 × 3 = 6 220 800 bytes.
  3. 6 220 800 ÷ 1024 = 6075 KiB; 6075 ÷ 1024 = 5.93 MiB.
Answer: about 5.93 MiB
Worked example From number of colours
A 1024 × 768 image uses 16 colours. Estimate its size in KiB.
  1. 16 colours = 24, so the colour depth is 4 bits.
  2. 1024 × 768 = 786 432 pixels × 4 bits = 3 145 728 bits.
  3. ÷ 8 = 393 216 bytes; ÷ 1024 = 384 KiB.
Answer: 384 KiB
Your turn
Estimate the size of a 640 × 480 image with 24-bit colour, in KiB.
Examiner trap

Multiplying by the number of colours instead of the colour depth is the most common error. 256 colours means 8 bits per pixel, not 256.

Stage 1 · Learn

Check what the sim just showed you

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

An image has a colour depth of 8 bits. How many different colours can each pixel be?

Quick check+10 XP

In the lab, what happens to the file size when the colour depth is halved?

Quick check+10 XP

What is stored in the file header of a bitmap?

Quick check+10 XP

What does a vector graphic store?

Section 03

Vector graphics.

The lab's bitmap or vector mode enlarges both kinds of image. The bitmap's pixels become blocks; the vector is redrawn from its drawing list and stays sharp.

Drawing objectProperties stored
Circlecentre (120, 80), radius 40, line colour black, line width 2, fill colour red
Rectangletop-left (20, 20), width 200, height 30, line colour blue, fill colour none
Linestart (0, 150), end (240, 150), line colour grey, line width 1
Examiner trap

"Vectors are smaller" is not always true. A complex scene with thousands of objects can need a larger vector file than a bitmap, and vectors cannot realistically store a photograph.

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

Estimate the file size of an 800 × 600 bitmap with 8-bit colour depth.

Exam style+20 XP

An image must show at least 1000 different colours. What is the minimum colour depth?

Exam style+20 XP

The width and height of a bitmap are both doubled; the colour depth is unchanged. What happens to the file size?

Exam style+20 XP

Which image is best stored as a vector graphic?

Skill unlocked

Bitmap and vector graphics, mastered.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
Pixels, colour depth, image and screen resolution, file headers, bitmap file sizes and vector drawing lists.