Show understanding of how changing the elements of a bitmap image, a vector graphic, or a digital sound sample affects image/audio quality and file size. Be able to calculate file sizes, compare formats and justify the most appropriate choice for a given purpose.
Choosing the right representation balances three factors:
Quality: more pixels → finer detail, smoother edges.
Size: file size ∝ total number of pixels.
Quality: higher bpp → more distinct colours, smoother gradients, less banding.
Size: file size ∝ bpp.
Example conversion: 1 440 000 bytes ÷ 1 048 576 bytes MiB⁻¹ ≈ 1.37 MiB.
\[
\text{File size (bits)} = \text{width} \times \text{height} \times \text{colour depth}
\]
\[
\text{File size (bytes)} = \frac{\text{File size (bits)}}{8}
\]
| Technique | Type | How it works | Typical ratio | Impact on quality |
|---|---|---|---|---|
| Run‑Length Encoding (RLE) | Lossless | Stores the length of consecutive identical pixels (e.g., 15 × white, 7 × black) | 2 : 1 – 3 : 1 (depends on image simplicity) | No visual loss; artefacts only if data is corrupted |
| Huffman coding | Lossless | Assigns shorter binary codes to more frequent colour values (variable‑length codes) | 2 : 1 – 4 : 1 | Preserves the original image |
| PNG (Deflate = LZ77 + Huffman) | Lossless | Combines dictionary compression (LZ77) with Huffman coding | 2 : 1 – 3 : 1 (often better for graphics with large solid colours) | No loss of detail |
| JPEG (DCT + quantisation) | Lossy | Transforms 8 × 8 blocks to the frequency domain, discards high‑frequency data according to a quality factor | 10 : 1 – 50 : 1 (or higher) | Possible blocking, blurring, colour‑shifting at high compression |
\[
\text{Size}=800\times600\times24=11\,520\,000\text{ bits}=1\,440\,000\text{ bytes}\approx1.37\text{ MiB}
\]
\[
\text{Size}\approx\frac{1.37\text{ MiB}}{2.5}=0.55\text{ MiB}
\]
\[
\text{Size}\approx\frac{1.37\text{ MiB}}{9}=0.15\text{ MiB}
\]
Notice the slight loss of sharpness compared with the PNG version.
<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
<rect x="20" y="20" width="160" height="160"
fill="#0066CC" stroke="#000000" stroke-width="2"/>
<path d="M20,180 C80,100 120,100 180,180"
fill="none" stroke="#FFCC00" stroke-width="4"/>
</svg>
The XML tags (<rect>, <path>) mathematically describe the shapes; the file size grows with the number of objects, not with the image’s pixel dimensions.
| Aspect | Bitmap (Raster) | Vector |
|---|---|---|
| Storage principle | Pixel matrix (colour per pixel) | Mathematical description of shapes |
| Scalability | Degrades when enlarged (pixelation) | Unlimited – edges remain crisp |
| Typical file size (same visual content) | Large for high‑resolution photos | Usually smaller for logos, icons, line art |
| Best use‑case | Photographs, complex textures | Logos, icons, UI elements, technical drawings |
| Editing | Pixel‑level (e.g., Photoshop) | Object‑level (e.g., Illustrator) |
Scenario: a web‑site logo consisting of two solid colours.
Justification: Choose SVG because the logo must appear sharp on both standard and high‑density screens while keeping bandwidth low.
\[
\text{Size (bits)} = \text{duration (s)} \times f_s \times \text{bit depth} \times \text{channels}
\]
\[
\text{Size (bytes)} = \frac{\text{Size (bits)}}{8}
\]
A 30‑second music clip, 44.1 kHz, 16‑bit, stereo:
\[
\begin{aligned}
\text{Size (bits)} &= 30 \times 44\,100 \times 16 \times 2 = 42\,384\,000\text{ bits}\\
\text{Size (bytes)} &= \frac{42\,384\,000}{8}=5\,298\,000\text{ bytes}\\
\text{Size (MiB)} &= \frac{5\,298\,000}{1\,048\,576}\approx5.05\text{ MiB}
\end{aligned}
\]
Calculate the uncompressed file size in KiB.
What is the approximate file size in KiB?
Find the uncompressed size in MiB.
Which format (PNG or SVG) would you recommend and why?
| Element | Effect on Quality | Effect on File Size | Typical Use‑case |
|---|---|---|---|
| Resolution (pixels) | More detail, smoother edges | Linear increase with width × height | Photographs, detailed images |
| Colour depth (bpp) | More colours → smoother gradients, less banding | Linear increase with bpp | High‑colour images, medical imaging |
| Lossless compression (RLE, Huffman, PNG) | No visual loss | 2 : 1 – 4 : 1 reduction (depends on image complexity) | Logos, screenshots, archival storage |
| Lossy compression (JPEG, MP3, AAC) | Possible artefacts (blocking, blurring, audible distortion) | 10 : 1 – 50 : 1 (or higher) reduction | Web photos, streaming audio/video |
| Vector format (SVG, EPS) | Infinitely scalable, crisp at any size | Usually very small for simple graphics; grows with object count | Icons, logos, technical drawings |
| Audio parameters (sample rate, bit depth, channels) | Higher rates → better frequency response and dynamic range | Size ∝ duration × sample‑rate × bit‑depth × channels | Music (high‑rate), speech (low‑rate) |
Use these questions to practise applying the concepts, performing calculations and evaluating trade‑offs – exactly what the Cambridge A‑Level exam expects.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.