Images and sound: size follows dimensions and fidelity choices
By UK GCSE Computer Science · independent study · myAudience

Original AI-generated teaching raster via built-in image_gen; author inspected 2026-10-04. · Generated project artwork; no copied exam or publisher illustration. Independent rights/publication review pending.
Images and sound: size follows dimensions and fidelity choices
A bitmap represents an image as pixels arranged in rows and columns. Colour depth is bits per pixel, so d bits can represent at most 2^d colour codes. Width and height are counts of pixels, not physical centimetres. Entry skills are bit-byte conversion and rectangular grids. The generated media raster's four-by-four example has 16 pixels and four colour codes, requiring two bits per pixel: 16×2=32 bits or four bytes of raw pixel payload. A file also needs a format and may have a header, palette, row padding or compression; this simple calculation deliberately excludes them.
To encode a two-bit bitmap, agree a palette such as 00 dark, 01 teal, 10 pale and 11 white, then read rows in a declared order. The first row 00 01 10 11 uses eight bits. Decoding reverses the same rule; using a different palette changes the picture even though the bits are intact. Increasing width and height each by a factor of two multiplies pixel count by four. Increasing depth from two to four bits doubles raw payload and increases representable codes from four to sixteen. More pixels and more depth can preserve more detail, but the effect depends on the source and display.
Sound is an analogue variation. Sampling records amplitude at selected instants; sampling rate counts samples per second in hertz. Sample resolution is bits per sample and controls the available discrete amplitude levels. Raising rate changes temporal sampling, while raising resolution changes amplitude quantisation. These are different mechanisms, so “more bits means more samples” is wrong. The sound panel is conceptual and does not claim a full original waveform can be recovered from finite quantised samples. It is not a measured recording, and the lesson makes no claim about hearing ability or medical benefit.
For one uncompressed channel, payload bits = sample rate × bits per sample × duration seconds. A 12-second signal at 8000 samples/s and 8 bits/sample uses 768,000 bits = 96,000 B = 96 kB. Two channels double the payload if they use the same rate and resolution; that channel multiplier is a useful extension to stated formula. Specify headers and channels in every problem. Mixing milliseconds with seconds or kHz with Hz introduces a factor of 1000 error even if the arithmetic operations are correct.
The program models raw sizes and rejects nonpositive dimensions or rates and negative duration. A zero-second duration has zero payload; real containers can still have a header. It does not open or fabricate an image or sound file. A result in bytes must round up if a bit payload is not byte-aligned and the storage format packs bits into whole bytes. The transfer combines alternative fidelity choices with a strict storage budget and asks for a reasoned choice; a size inequality alone cannot prove the result is suitable for the intended use.
Runnable original Python 3 example (also saved verbatim in examples for CLI execution):
```python
def bitmap_bits(width, height, depth):
"""Raw packed pixels only, without header, palette or padding."""
if any(type(x) is not int or x <= 0 for x in (width, height, depth)):
raise ValueError("positive integer dimensions and depth required")
return width * height * depth
def audio_bits(rate_hz, resolution, seconds, channels=1):
"""Uncompressed PCM payload; integer sample count assumed."""
if any(type(x) is not int or x <= 0 for x in (rate_hz, resolution, channels)):
raise ValueError("positive rate, resolution and channels required")
if type(seconds) is not int or seconds < 0:
raise ValueError("whole nonnegative seconds required")
return rate_hz * resolution * seconds * channels
def packed_bytes(bits):
return (bits + 7) // 8
assert bitmap_bits(4, 4, 2) == 32
assert packed_bytes(bitmap_bits(3, 3, 1)) == 2
assert audio_bits(8000, 8, 12) == 768000
```
Worked example: Calculate payload for a 320×200 bitmap with 16 colours, excluding headers.
16 colours require four bits per pixel.
320×200=64,000 pixels; times four gives 256,000 bits.
Divide by eight to get 32,000 bytes; decimal units give 32 kB.
Answer: 32 kB raw pixel payload.
Check your understanding: Transfer: a 100 kB payload budget stores 12 seconds of mono sound. Compare 8000 Hz/8-bit with 8000 Hz/16-bit and 4000 Hz/16-bit. Which fit, and what can you conclude about fidelity without hearing or analysing the signal?
Answer: Sizes are 96 kB, 192 kB and 96 kB respectively. First and third fit the payload budget; headers may reduce available payload. First samples time more densely; third quantises amplitude more finely. Neither is universally better without the signal and use requirements.
Why: Equal byte sizes do not mean equal information retention. Halving rate compensates numerically for doubling resolution but changes a different aspect of representation. A good answer distinguishes dimensioned calculation from evidence about perceptual suitability.