A digital image is made up of a grid of tiny squares called pixels (picture elements). Each pixel stores a single colour value as a binary number. The quality and detail of an image depends on how many pixels it has and how many colours each pixel can represent.
Resolution is the number of pixels in an image, typically expressed as width × height (e.g. 1920×1080). The total number of pixels = width × height.
Colour depth (bit depth) is the number of bits used to represent the colour of each pixel. More bits = more possible colours.
| Colour depth | Colours possible | Example |
|---|---|---|
| 1 bit | 2¹ = 2 | Black and white only |
| 4 bits | 2⁴ = 16 | Early computer graphics |
| 8 bits | 2⁸ = 256 | GIF images |
| 24 bits | 2²⁴ = 16,777,216 | True colour (24-bit RGB) |
The (uncompressed) file size of an image in bits is calculated as:
Example: A 640 × 480 image with 24-bit colour depth:
| Factor | Effect on file size |
|---|---|
| Increase resolution (more pixels) | File size increases |
| Increase colour depth (more bits per pixel) | File size increases |
| Use compression | File size decreases (may affect quality) |