Teachers' Portal  /  A-Level Computer Science 9618  /  Information representation  /  Bitmap and vector graphics
Lesson pack · A-Level Computer Science 9618 · 1.2 · AS Level

Bitmap and vector graphics

Pixels or shapes? A photo and a logo can look alike on screen, but they are stored in completely different ways.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Information representation
Syllabus reference
Cambridge International AS and A Level Computer Science 9618, 1.2
Level
AS Level
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 5 of 7 in Information representation; follows Character sets: ASCII, extended ASCII and Unicode; leads into Sampled sound
Central model
Fig. 1: a bitmap stores every pixel; a vector stores objects and their properties
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • How a bitmap is encoded: In the lab, change the resolution and the colour depth of the image.
  • Estimating file size: The pixel data is width × height × colour depth bits.
  • Vector graphics: The lab's bitmap or vector mode enlarges both kinds of image.
Key points to leave on the board
  • File size: width × height × colour depth bits; ÷ 8 for bytes, ÷ 1024 for KiB.
  • Colour depth: n bits give 2n colours; find the smallest n that is enough.
  • Vector: drawing list of drawing objects, each with properties; scales without pixelation.
  • Justify: bitmap for photographs; vector for logos, diagrams and anything resized often.
The core visual model

One picture every idea returns to

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
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Pixels or shapes?. A photo and a logo can look alike on screen, but they are stored in completely different ways. Put the figure on the board: it is the one picture every idea in the lesson returns to.Whole class, then pairs
5 to 13 minTeach and check: How a bitmap is encodedIn the lab, change the resolution and the colour depth of the image. Project tab 3 of the lab (Resolution and colour depth) and let a student drive it while the class predicts.Whole class, then pairs
13 to 21 minTeach and check: Estimating file sizeThe pixel data is width × height × colour depth bits. Model the worked example Full HD photo on the board, one line at a time. Your turn: Estimate the size of a 640 × 480 image with 24-bit colour, in KiB.Pairs
21 to 30 minTeach and check: Vector graphicsThe lab's bitmap or vector mode enlarges both kinds of image. Project tab 6 of the lab (Bitmap or vector) and let a student drive it while the class predicts.Mix-Pair-Share
30 to 36 minCheckThe four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong.Individual, then whole class
36 to 43 minPlenaryThe exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording.Individual, random call
43 to 45 minExit and homeworkSet the worksheet below (6 questions, 18 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

Protect the parts that carry the learning

The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.

Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.

Cut first if the build overruns: the last check in Vector graphics, never the check or the plenary.

In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.

Running the cooperative task

Mix-Pair-Share

Students mix around the room until you call pair; they pair with the nearest classmate, discuss the prompt, then mix again. Three prompts of rising difficulty, three different partners.

The full structure, with its variations and the other twelve, is on the cooperative-learning page.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching move that pre-empts it
Do not confuse image resolution with screen resolution.Image resolution belongs to the file; screen resolution belongs to the display.
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.Return to Estimating file size: ask a pair to state the correct version and show it on the lab before moving on.
"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.
Worksheet

Bitmap and vector graphics: worksheet

6 questions, 18 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · recall[3 marks]

Define the terms pixel, image resolution and colour depth.

Q2 · calculate[3 marks]

A bitmap is 2048 pixels wide and 1536 pixels high, with a colour depth of 16 bits. Estimate its file size in MiB. Show your working.

Q3 · explain[2 marks]

Explain the effect of increasing the colour depth of a bitmap image on its quality and on its file size.

Q4 · explain[3 marks]

Describe how a vector graphic is encoded.

Q5 · apply[4 marks]

A school needs (a) a photograph of its sports team for its website and (b) its crest, which will be printed on letters, shirts and a large banner. Justify whether each should be a bitmap or a vector graphic.

Q6 · calculate[3 marks]

A 1200 × 800 pixel image must be able to show at least 200 different colours. Calculate the minimum colour depth and the estimated file size in KiB.

Answer key and marking notes
Q1 · 3 marks
  • Pixel: the smallest addressable element of a bitmap image, with one colour.
  • Image resolution: the number of pixels in the image (width × height).
  • Colour depth: the number of bits used to represent the colour of each pixel.
Q2 · 3 marks
  • 2048 × 1536 = 3 145 728 pixels.
  • × 2 bytes = 6 291 456 bytes.
  • 6 291 456 ÷ 1 048 576 = 6 MiB.
Q3 · 2 marks
  • More colours can be represented, so colours are more accurate / gradients are smoother.
  • More bits are stored per pixel, so the file size increases (in proportion to the colour depth).
Q4 · 3 marks
  • It is stored as a drawing list (a list of commands).
  • Each item is a drawing object, such as a line, circle or rectangle.
  • Each object has properties, e.g. coordinates, radius, line colour, line width, fill colour.
Q5 · 4 marks
  • (a) Bitmap.
  • A photograph has many complex colour changes that cannot be described by simple shapes.
  • (b) Vector.
  • The crest is made of shapes and can be scaled to any size without losing quality / becoming pixelated.
Q6 · 3 marks
  • 27 = 128 is too few and 28 = 256 is enough, so 8 bits.
  • 1200 × 800 = 960 000 pixels × 1 byte = 960 000 bytes.
  • 960 000 ÷ 1024 = 937.5 KiB.
Quiz

6 multiple-choice questions on this lesson

From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.

Q11 mark

What is meant by the colour depth of a bitmap image?

  • AThe number of bits used to represent the colour of each pixel
  • BThe number of pixels in the image, given as width × height
  • CThe number of different colours the screen can display
  • DThe number of pixels in each inch of the printed image
Q21 mark

Estimate the file size of an 800 × 600 bitmap image that uses 256 colours. Ignore the file header.

  • A468.75 KiB
  • B15 000 KiB
  • C3750 KiB
  • D480 KiB
Q31 mark

A bitmap image is edited so that its width and its height are both doubled and its colour depth goes from 8 bits to 16 bits. By what factor does the file size (ignoring the header) increase?

  • A8
  • B4
  • C6
  • D2
Q41 mark

What does a vector graphic file store?

  • AA drawing list of objects, each described by properties such as position, size and fill colour
  • BA binary colour code for every pixel in the image grid
  • COnly a file header giving the width, height and colour depth
  • DThe image as runs of identical pixels with a count for each run
Q51 mark

Which statement comparing bitmap and vector graphics is correct?

  • AA scene with thousands of drawing objects can need a larger file as a vector than as a bitmap
  • BA vector file is always smaller than a bitmap of the same picture
  • CEnlarging a vector graphic makes it pixelated because the pixels are stretched
  • DA photograph is stored most efficiently as a vector graphic
Q61 mark

A 1024 × 768 bitmap image needs exactly 1.5 MiB, ignoring the file header. What is its colour depth?

  • A16 bits
  • B2 bits
  • C24 bits
  • D65 536 bits
Quiz key
Q1: A

Colour depth is bits per pixel, so n bits allow 2n colours. Width × height is the image resolution, what the screen can display is a property of the display, and pixels per inch describes print density, not how each pixel is encoded.

Q2: A

256 = 28, so 8 bits (1 byte) per pixel: 800 × 600 = 480 000 bytes = 480 000 ÷ 1024 = 468.75 KiB. 15 000 KiB multiplies by 256 instead of 8, 3750 KiB leaves the answer in bits, and 480 KiB divides by 1000 but labels the result as kibibytes.

Q3: A

Doubling width and height multiplies the number of pixels by 2 × 2 = 4, and doubling the colour depth multiplies by another 2: 4 × 2 = 8. 4 forgets the colour depth, 6 adds the factors instead of multiplying, and 2 only counts one change.

Q4: A

A vector file holds a drawing list: commands for objects such as circles and lines, with their properties. Storing a colour code for every pixel describes a bitmap, a header alone cannot rebuild an image, and counts of identical pixels describe run-length encoding of a bitmap.

Q5: A

Every object and its properties must be stored, so a very complex scene can produce a larger vector file than the bitmap. Vectors are usually smaller only for simple shapes. Vectors are recalculated when scaled, so they do not pixelate, and photographs with continuous colour changes are stored as bitmaps.

Q6: A

1.5 MiB = 1.5 × 1 048 576 × 8 = 12 582 912 bits, and 1024 × 768 = 786 432 pixels, so 12 582 912 ÷ 786 432 = 16 bits per pixel. 2 is the answer in bytes per pixel, 24 bits would give 2.25 MiB, and 65 536 is the number of colours that 16 bits allow, not the depth.

Lab and demo

What to project

The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.

Slides

Slides for this lesson

A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonCharacter sets: ASCII, extended ASCII and Unicode