PyGCSE Python Lab

Image Representation — Bitmaps, Resolution & Colour Depth

Learn how digital images are stored as bitmaps using pixels, resolution, and colour depth, and how to calculate file sizes.

📚 Learning Steps

💡 Study Tips
  • • Read through at your own pace
  • • Try the interactive simulators hands-on
  • • Study the pseudocode — it appears in exams
  • • Quiz yourself before moving on

Step 1: How Are Digital Images Stored?

📖 Theory

A bitmap 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 two key properties of a bitmap are:

1. Resolution — the number of pixels in the image

Measured as width × height (e.g., 1920 × 1080)
Higher resolution = more pixels = more detail = larger file

2. Colour depth — the number of bits used to store each pixel's colour

1 bit = 2 colours (black/white)
8 bits = 256 colours
24 bits = 16,777,216 colours ("true colour")
Higher colour depth = more colours available = larger file

The image is stored row by row, pixel by pixel, as a long sequence of binary values. Metadata (width, height, colour depth) is stored in a header at the start of the file.

🎯 Key Points
  • Bitmap = grid of pixels, each storing a colour as binary
  • Resolution = width × height in pixels
  • Colour depth = number of bits per pixel
  • More pixels or more bits per pixel → larger file size
  • Image metadata (dimensions, colour depth) is stored in a file header
0/5 steps completed