Bitmap and vector graphics
| English | Chinese | Pinyin |
|---|---|---|
| bitmap | 位图 | wèi tú |
| vector | 矢量 | shǐ liàng |
| pixel | 像素 | xiàng sù |
| file header | 文件头 | wén jiàn tóu |
| colour depth | 颜色深度 | yán sè shēn dù |
| image resolution | 图像分辨率 | tú xiàng fēn biàn lǜ |
| screen resolution | 屏幕分辨率 | píng mù fēn biàn lǜ |
| drawing list | 绘图列表 | huì tú liè biǎo |
| drawing object | 绘图对象 | huì tú duì xiàng |
| primitive | 图元 | tú yuán |
| properties | 属性 | shǔ xìng |
| render | 渲染 | xuàn rǎn |
Two ways to store a picture
- A computer can store an image as a grid of coloured dots, or as a set of drawing instructions.
- These are bitmap 位图 and vector 矢量 graphics.
- Each is best for different jobs — and the difference shows when you zoom in.
Computing concept lab
Classify concrete examples by the computing idea they demonstrate.
Bitmap images
- A bitmap stores the colour of every pixel 像素 in a grid; a file header 文件头 records its width, height and colour depth.
- Image resolution 图像分辨率 = width × height in pixels (e.g. $1920 \times 1080$); the screen resolution 屏幕分辨率 is what the display can show.
- Colour depth 颜色深度 (bit depth) = bits per pixel: 1 bit → black/white; 8 bits → 256 colours; 24 bits → 16.7 million ("true colour").

The colour depth (bit depth) of a bitmap image is:
Colour depth is bits per pixel — more bits means more possible colours (8 bits → 256, 24 bits → 16.7 million).
How many bits of colour depth are needed to store 256 different colours?
$2^8 = 256$, so 8 bits per pixel give 256 colours.
Bitmap file size
- The file size depends on the pixel count and the colour depth:
- Divide by 8 for bytes. Example: $3000 \times 2000$ at 24 bpp $= 1.44 \times 10^8$ bits $\approx 17.2\ \text{MiB}$.
- Lower resolution or lower colour depth → smaller file but worse quality (blocky, or colour banding).

A vector image is built from labelled geometric shapes
A $100 \times 100$ pixel image has a colour depth of 24 bits. What is its file size in bits?
size $=$ width $\times$ height $\times$ depth $= 100 \times 100 \times 24 = 240\,000$ bits.
Vector graphics
- A vector graphic stores the instructions to draw the image as a drawing list 绘图列表 of drawing objects 绘图对象 (geometric primitives 图元: lines, curves, polygons, circles), each with properties 属性 (colour, fill, width, position).
- To display it, the program renders 渲染 the instructions at whatever resolution is needed.
- So it scales without losing quality — a vector logo stays sharp at any size.
- But it cannot describe arbitrary pixel detail, so it is no good for photographs.
A vector logo becomes blurry when you enlarge it a lot.
Vectors are re-rendered from instructions at any size, so they stay sharp. It is bitmaps that blur when enlarged.
The main advantage of a vector graphic is that it:
Because it is drawn from instructions, a vector scales without blur — ideal for logos and diagrams (but not photos).
Bitmap vs vector
| Task | Better choice | Why |
|---|---|---|
| Photograph | Bitmap | per-pixel detail can't be shapes |
| Logo, icon, sign | Vector | sharp edges, scales to any size |
| Engineering drawing | Vector | precise geometry and scaling |
| Painting, texture | Bitmap | smooth tonal detail |
- A bitmapped image means the same as a bitmap — a stored grid of pixels.
Which format is better for storing a photograph?
A photo has complex per-pixel detail that cannot be described as shapes, so a bitmap is the right choice.
You've got it
- bitmap = grid of pixels; resolution + colour depth (bits/pixel)
- bitmap file size $=$ width $\times$ height $\times$ colour depth (bits)
- vector = drawing instructions (primitives + attributes); scales without blur
- photos → bitmap; logos/diagrams → vector