Graphics: Pixels, Resolution and Colour Depth
How Images Are Stored as Bitmaps
A digital image is made up of a grid of tiny coloured squares called pixels (short for “picture elements”). When a computer stores a bitmap image, it records the colour of every single pixel as a binary number. The whole image is then nothing more than a long sequence of binary codes — one for each pixel, row by row from top-left to bottom-right.
A bitmap image file also includes metadata: information about the image itself, such as its width in pixels, its height in pixels, its colour depth, and the date it was created. The metadata tells software how to interpret the stream of pixel data that follows it.
Resolution
The resolution of an image describes how many pixels it contains. It is usually given as width × height in pixels (for example, 1920 × 1080). A higher resolution means more pixels and therefore more detail — but also a larger file size, because there is more pixel data to store.
Resolution can also be expressed in pixels per inch (ppi) when describing how sharply an image will print. A higher ppi means smaller pixels printed more densely, producing a sharper result. However, on screen, the physical size of pixels is fixed by the display hardware, so ppi matters less for on-screen display than total pixel count.
Colour Depth (Bit Depth)
Colour depth (sometimes called bit depth) is the number of bits used to store the colour of each pixel. The more bits per pixel, the greater the number of possible colours:
- 1-bit — \(2^1 = 2\) colours (black or white only).
- 8-bit — \(2^8 = 256\) colours. Used in early graphics and GIF files.
- 24-bit — \(2^{24} = 16{,}777{,}216\) colours (“true colour”). Eight bits each for red, green and blue channels.
The formula for the uncompressed size of a bitmap image is:
File size (bits) = width (pixels) × height (pixels) × colour depth (bits per pixel)
To convert to bytes, divide by 8. To convert bytes to kilobytes, divide by 1024. In this course a kilobyte is 1024 bytes, so never divide by 1000.
An image is 640 × 480 pixels with a colour depth of 24 bits per pixel. Calculate its uncompressed file size in kilobytes.
Step 1 — total bits: 640 × 480 × 24 = 7,372,800 bits.
Step 2 — convert to bytes: 7,372,800 ÷ 8 = 921,600 bytes.
Step 3 — convert to kilobytes: 921,600 ÷ 1024 = 900 KB.
This is the uncompressed (raw bitmap) size. Saving as a JPEG would reduce this significantly through lossy compression, but some image quality would be lost.
Effect of Resolution and Colour Depth on Quality and File Size
Increasing either the resolution or the colour depth increases both image quality and file size. These relationships are directly proportional:
- Double the width and height → four times the number of pixels → four times the file size.
- Double the colour depth (e.g. from 8-bit to 16-bit) → file size doubles.
Designers must balance quality against file size. A high-resolution 24-bit photograph looks stunning on screen but takes longer to download and uses more storage. A low-resolution 8-bit image loads quickly but may look pixelated or washed out.
A 24-bit colour image uses three bytes per pixel (8 bits for red + 8 for green + 8 for blue). This RGB model allows over 16 million colour combinations, which is enough that the human eye cannot distinguish individual gradations — hence the term “true colour.”
Misconception 1: “Resolution is the same as quality.” — Resolution is the number of pixels; quality also depends on colour depth. A 4K image with 1-bit colour would look terrible.
Misconception 2: “A kilobyte is 1000 bytes.” — Not in this course. Storage units here are base-2, so 1 KB = 1024 bytes. Drive manufacturers advertise using 1000 bytes, which is why a new drive holds less than the box claims. Dividing by 1000 in a calculation question will cost you a mark.
Misconception 3: “More colours always means a bigger file.” — True for uncompressed bitmaps, but compression algorithms can reduce file size regardless of colour depth. Always check whether the question says “uncompressed”.