Bitmap Image Representation & Pixel Challenge
Explore how computers store bitmap images as grids of binary numbers. Paint pixel art, decode binary and hexadecimal scanlines, solve interactive encoding challenges, and see why image metadata is vital to prevent severe graphic distortion.
Bitmap Image Representation & Pixel Challenge
Edit the code below in real time or copy it for your notes. Each row corresponds directly to horizontal scanlines on the canvas.
📐 Image File Size Math (AQA 3.3.6)
Spec FormulaFormula:
File Size (bits) = Width × Height × Colour Depth
Image size: 8 × 8 = 64 pixels
Colour Depth: 1 bit per pixel (2 colours)
Calculation: 64 × 1 = 64 bits
In bytes: 64 ÷ 8 = 8 bytes
Exam Tip: read whether the question asks for the size in bits or in bytes. Width × height × colour depth gives bits; divide by 8 for bytes.
⚠️ Why is Metadata Required? (Live Test)
Exam ConceptA computer stores the image as a single, uninterrupted 1D line of 64 bits. There are no invisible row markers in the file! If the width metadata in the file header is lost or incorrect, the computer wraps rows at the wrong point.
How Computers Store Images as Binary
Every digital bitmap graphic is composed of a rectangular grid of tiny picture elements called pixels. A pixel is the smallest single addressable element in a digital image.
1-Bit Monochrome Images
In a monochrome bitmap, each pixel is either off or on (white or black). Because there are only 2 possible states, each pixel requires exactly 1 bit:
- • 0 = White (background)
- • 1 = Black (foreground)
An 8-pixel horizontal row is represented by 8 bits (1 full byte). For example, 00111100 represents two empty pixels, four filled pixels, and two empty pixels.
Colour Depth & The 2ⁿ Rule
Colour depth (or bit depth) is the number of bits allocated to each individual pixel. The number of unique colours available is calculated using 2ⁿ, where n is the colour depth in bits:
• 1 bit: 2¹ = 2 colours (Monochrome)
• 2 bits: 2² = 4 colours (CGA / retro console)
• 8 bits: 2⁸ = 256 colours (VGA / GIF)
• 24 bits: 2²⁴ = 16,777,216 colours (True Colour / 8-bit RGB)
The File Size Formula (AQA 8525 Spec 3.3.6)
AQA exams routinely test image file size calculations. Always state the formula and show each working step clearly:
File Size (bits) = Width × Height × Colour Depth (bits per pixel)
To convert bits to bytes, divide by 8. Exam questions ask for the size in bits or in bytes, so check which.
Calculate the file size in bytes of a 200 × 100 monochrome image.
- 1. Total pixels = 200 × 100 = 20,000 pixels
- 2. Monochrome = 1 bit per pixel
- 3. Total bits = 20,000 × 1 = 20,000 bits
- 4. Convert to bytes = 20,000 ÷ 8 = 2,500 bytes
An image is 40 × 30 pixels with 16 available colours. Calculate the size in bytes.
- 1. Determine bit depth: 16 colours = 2⁴ → 4 bits per pixel
- 2. Total pixels = 40 × 30 = 1,200 pixels
- 3. Total bits = 1,200 × 4 = 4,800 bits
- 4. Convert to bytes = 4,800 ÷ 8 = 600 bytes
Why Image Metadata is Essential (The 2-Mark Exam Question)
AQA frequently asks: “Explain why metadata is included in a bitmap image file, giving two examples of metadata stored.”
The Model Answer:
- • Why it is needed: Image files store raw pixel data as a continuous stream of binary 0s and 1s without row breaks. The operating system or graphic software needs metadata stored in the file header to know the dimensions and colour format so it can reconstruct the image correctly on the screen rather than rendering static or corrupted noise.
- • Examples of metadata stored: Width (in pixels), Height (in pixels), Colour depth (bits per pixel), Resolution (dpi), File creation date, and Author/camera details.
Three Common Mistakes That Cost Marks in AQA Exams
Mistake 1: Forgetting to Convert Between Bits and Bytes
The formula gives the size in bits. If the question asks for bytes, divide by 8, or you lose the final mark; if it asks for bits, don't divide. Always check which unit the question asks for.
Mistake 2: Confusing Number of Colours with Number of Bits
If an image has 256 colours, students sometimes multiply the pixels by 256. This is incorrect! 256 colours requires 8 bits per pixel because 2⁸ = 256. Always multiply by the colour depth (8), not the total number of colours.
Mistake 3: Believing Metadata Improves Image Quality
Metadata does not improve resolution, contrast, or color fidelity. Metadata is merely descriptive header data that tells the computer how to interpret the bitstream.
Master Every GCSE Computer Science Topic
Revise Data Representation, Algorithms, Networks, and Cybersecurity with interactive tools and tracked assessments.
