Calculate the file size of an image file and a sound file, using information given

📚 Data Storage & Compression – IGCSE 0478

Objective

Calculate the file size of an image file and a sound file using the given information.

📷 Image File Size

Think of an image as a photo frame made of tiny coloured squares called pixels. Each pixel stores colour information.

  1. Number of pixels = width × height.
  2. Each pixel uses a certain number of bits (colour depth). Common depths: 8‑bit (256 colours), 24‑bit (16 777 216 colours).
  3. File size in bits = pixels × bits per pixel.
  4. Convert bits to bytes: divide by 8.
  5. Convert bytes to kilobytes (KB) or megabytes (MB) as needed.

Example: 1920 × 1080 image, 24‑bit colour.

Step Calculation Result
Pixels 1920 × 1080 2 073 600
Bits per pixel 24 24
File size (bits) 2 073 600 × 24 49 766 400
File size (bytes) 49 766 400 ÷ 8 6 220 800
File size (MB) 6 220 800 ÷ 1 048 576 ≈ 5.94 MB
Exam Tip: Always remember bits → bytes (÷8) and bytes → KB (÷1024) or MB (÷1 048 576).

🎧 Sound File Size

Sound is like a tape that records vibrations. The amount of data depends on:

  • Sample rate (samples per second) – e.g., 44.1 kHz.
  • Bit depth (bits per sample) – e.g., 16‑bit.
  • Number of channels – 1 for mono, 2 for stereo.
  • Duration (seconds).

Formula: File size (bits) = sample rate × bit depth × channels × duration.

Example: 44.1 kHz, 16‑bit, stereo, 3 minutes (180 s).

Parameter Value
Sample rate 44 100 Hz
Bit depth 16 bits
Channels 2 (stereo)
Duration 180 s
File size (bits) 44 100 × 16 × 2 × 180 253 344 000
File size (bytes) 253 344 000 ÷ 8 31 668 000
File size (MB) 31 668 000 ÷ 1 048 576 ≈ 30.2 MB
Exam Tip: Write the full formula before plugging in numbers. Check units (Hz, bits, seconds) to avoid mistakes.

🔍 Compression Basics

Compression reduces file size by removing redundant or unnecessary data.

  • Lossless: No data lost (e.g., PNG, FLAC). Useful when quality matters.
  • Lossy: Some data discarded for smaller size (e.g., JPEG, MP3). Acceptable for images/sounds where perfect fidelity isn’t critical.

Typical compression ratios:

Format Compression Type Typical Ratio
PNG Lossless ~2–5 ×
JPEG Lossy ~10–20 ×
FLAC Lossless ~2–3 ×
MP3 Lossy ~10–12 ×
Exam Tip: When asked about compression, identify whether the format is lossless or lossy and give a typical compression ratio. Use the example ratios above as a quick reference.

💡 Quick Summary

  • Image size = width × height × bits per pixel ÷ 8.
  • Sound size = sample rate × bit depth × channels × duration ÷ 8.
  • Always convert bits → bytes, then to KB/MB.
  • Compression reduces size; lossless keeps all data, lossy removes some.
Final Exam Tip: Practice converting between units and applying the formulas. Remember the order of operations: multiply first, then divide. Good luck! 🚀

Revision

Log in to practice.

1 views 0 suggestions