You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Computers store images as collections of tiny dots called pixels. This lesson explains how bitmap images are represented in binary, and the factors that affect image quality and file size.
A bitmap image is made up of a grid of pixels (picture elements). Each pixel is a single coloured dot. When you zoom into a bitmap image, you can see the individual square pixels.
The computer stores a binary value for each pixel that represents its colour. The entire image is stored as a long sequence of binary values — one for each pixel.
Resolution refers to the number of pixels in an image, usually expressed as width × height (e.g. 1920 × 1080 pixels).
Colour depth is the number of bits used to represent the colour of each pixel.
| Colour Depth | Number of Colours | Example |
|---|---|---|
| 1 bit | 2 | Black and white |
| 2 bits | 4 | 4-colour palette |
| 4 bits | 16 | 16-colour palette |
| 8 bits | 256 | 256-colour palette |
| 16 bits | 65,536 | High colour |
| 24 bits | 16,777,216 | True colour (RGB) |
The formula for the number of available colours is:
Number of colours = 2^(colour depth)
In 24-bit colour (also called true colour), each pixel uses 24 bits — 8 bits for red, 8 bits for green, and 8 bits for blue (the RGB colour model).
| Colour | Red | Green | Blue | Hex Code |
|---|---|---|---|---|
| White | 255 | 255 | 255 | #FFFFFF |
| Black | 0 | 0 | 0 | #000000 |
| Pure Red | 255 | 0 | 0 | #FF0000 |
| Pure Green | 0 | 255 | 0 | #00FF00 |
| Pure Blue | 0 | 0 | 255 | #0000FF |
| Yellow | 255 | 255 | 0 | #FFFF00 |
A bitmap image file also contains metadata — additional data stored alongside the pixel data. Metadata typically includes:
This metadata is stored in the file header and is needed so that the computer knows how to reconstruct the image from the binary data.
flowchart LR
A[Image: grid of pixels] --> B[Each pixel: colour value]
B --> C[Colour depth: bits per pixel]
A --> D[Resolution: width x height]
C --> E[File size in bits]
D --> E
E --> F[Bytes / 8, KB / 1024, MB / 1024]
The file size of a bitmap image can be estimated using:
File size (bits) = Width (pixels) × Height (pixels) × Colour depth (bits per pixel)
An image is 800 × 600 pixels with a colour depth of 24 bits.
An image is 200 × 200 pixels with a colour depth of 8 bits.
| Change | Effect on Quality | Effect on File Size |
|---|---|---|
| Increase resolution | Image is sharper and more detailed | File size increases |
| Decrease resolution | Image is blockier and less detailed | File size decreases |
| Increase colour depth | More colours, more realistic image | File size increases |
| Decrease colour depth | Fewer colours, less realistic image | File size decreases |
Exam Tip: File size calculations are very common in the exam. Make sure you can convert between bits, bytes, kilobytes, and megabytes. Remember: 8 bits = 1 byte, 1024 bytes = 1 KB, 1024 KB = 1 MB. Always show your working clearly.
A logo is 256 × 256 pixels with a colour depth of 1 bit (each pixel is either black or white).
This shows how cheap monochrome images are to store. A 1-bit colour depth gives 2^1 = 2 colours.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.