Skip to content

1.2.5 Compression

GCSE · Paper 1 · Computer systems · Section 1.2 · 15 flashcards · 10 practice questions

Questions

1.2.5 Compression

Files such as photos, songs and videos can be very big. Compression makes a file smaller, so it takes up less space and is quicker to send.

Definition
Compression is making a file smaller, so that it needs fewer bits to store. A compressed file uses less storage and less data to send.

Why we compress files

Smaller files have several benefits:

  • •
    They take up less storage space, so more files fit on a phone, memory card or server.
  • •
    They are quicker to upload and download, and quicker to send as an email attachment.
  • •
    They use less bandwidth (the amount of data a network can carry in a second). This matters when many people use the same network.
  • •
    They can be streamed more easily. A song or a video that is compressed can play without long pauses, even on a slow connection.

Common scenarios

ScenarioWhy compression is used
Emailing photosMany email systems limit the size of attachments
Streaming video or musicSmaller files arrive fast enough to play without stopping
A website with many imagesPages load faster and use less data on a phone
Storing a large photo collectionMore photos fit on the device
Downloading a game or programThe download is smaller and quicker

There are two types of compression: lossy and lossless. You do not need to know how to carry out a particular compression method. You need to know what each type does to a file, and which to choose.

Lossy compression

Definition
Lossy compression makes a file smaller by permanently removing some of the data. The original file cannot be restored exactly.

The data that is removed is chosen so that people are unlikely to notice. For example, a photo may lose small differences in colour that the eye can hardly see. A song may lose very quiet sounds that are hard to hear.

The effect on the file
  • •
    The file is much smaller.
  • •
    The quality is lower. If too much data is removed, the picture looks blocky or blurred, or the sound is poor.
  • •
    The data that was removed is gone for good. You cannot get the original back.
Lossy compression suits photos, music and video, where a small drop in quality does not matter much and small files are important.
Pros & Cons
Advantages of lossyDisadvantages of lossy
Makes files much smaller than losslessSome data is lost for good
Saves storage space and download timeQuality is lower
Good for streaming and websitesNot suitable when every bit of data matters
Warning
Lossy compression applies the loss each time you save. If you open a lossy file, edit it and save it again as lossy, you lose more data. Keep the original file safe, and make lossy copies from that.

Lossless compression

Definition
Lossless compression makes a file smaller without losing any data. The original file can be rebuilt exactly when the file is opened.

Lossless compression finds ways to store the same information using fewer bits, and no information is lost. You do not need to know how.

The effect on the file
  • •
    The file is smaller, but not as small as with lossy compression.
  • •
    The quality is exactly the same as the original.
  • •
    The original data can be restored in full.
Lossless compression suits files where nothing may be lost: text documents, spreadsheets, programs and data files. If even one bit of a program were missing, it might not run. It also suits images and sound when perfect quality is needed, for example a professional photo that will be edited and printed.
Pros & Cons
Advantages of losslessDisadvantages of lossless
No data is lostFiles are bigger than with lossy
Original can be restored exactlyLess space saved
Best qualitySlower to send and needs more storage than lossy

Lossy and lossless compared

LossyLossless
Data removed?Yes, for goodNo
Can the original be restored?NoYes, exactly
File sizeMuch smallerSmaller, but not as small
QualityLowerSame as the original
Typical file typesJPEG images, MP3 audio, MP4 videoPNG images, FLAC audio, ZIP files
Best forPhotos, music and video on the web, where small size mattersText, programs, spreadsheets, and images where quality must be perfect
Worked Example
A 40 MB music file is compressed to 4 MB. Find how much smaller it is, and say which type was used if the sound quality is now lower.

Space saved: 40 - 4 = 36 MB.
The new file is 40 / 4 = 10 times smaller.
Lower quality means some data has been removed for good, so this is lossy compression.

Answer: 36 MB saved, 10 times smaller, lossy

Choosing the right type

Ask two questions:

  • 1.
    Does any data have to be kept? If yes (a program, a spreadsheet, a legal document), use lossless.
  • 2.
    Is a small file more important than perfect quality (a streamed film, a web page photo)? If yes, use lossy.
Exam Tip
When asked to choose, say which type, then give a reason that fits the scenario. For example: "Lossless, because a spreadsheet cannot lose any data, or the numbers would be wrong." Also say what you give up: "Lossy files are smaller, but the quality is lower."

Exam technique

  • •
    State questions need one fact. For example, "lossy compression removes data permanently".
  • •
    Describe questions need what happens to the file. Say whether data is removed, whether the original can be restored and how the file size changes.
  • •
    Explain questions need a reason, linked to the scenario. Use "because" and the benefit, such as "the file is smaller, so it downloads faster".
  • •
    Compare questions need a point about both types. For example, "lossy files are smaller, but lossless files keep all of the data".
  • •
    Discuss questions (8 marks) need both types, with advantages and disadvantages applied to the scenario, and then a clear conclusion. Do not describe how any algorithm works. The exam does not ask for that.