4.8: Compression

Exam Board:

Eduqas / WJEC

Specification:

2020 + 

What is compression?

To compress a file means to make its size smaller.

 

Benefits of compression include:

  • Files take up less storage space (so more files can be stored).

  • Files can be transferred quicker (because they are smaller).

  • Files can be read from or written to quicker.

There are two methods that are used to compress files: Lossy and Lossless.

Lossy Compression

Lossy compression uses an algorithm (set of instructions) to analyse a file and remove data that cannot be heard or seen by humans. For example, a lossy algorithm would analyse the sound waves of an audio file and remove any frequencies which humans cannot hear. This process reduces the size of the file.

Further lossy compression will remove data that humans can see / hear. For example, the dog image to the right has been strongly compressed using a lossy algorithm and some data has clearly been removed.

 

Lossy compression removes the data permanently, so the file can never return to its original form.

Lossy compression is often used with images, audio and video to reduce the file size, for example to send over the internet.

Lossless Compression

Lossless compression reduces the size of a file without permanently removing any data. Because of this, the file is returned to its original form when decompressed, so no quality is lost.

A file that is compressed with a lossless algorithm is usually larger than a file compressed with a lossy algorithm because no data has been permanently removed. 

 

Lossless compression is used with files that would not work if data was removed, for example executable files (e.g. programs and games) or word documents.

Remember that lossy and lossless compression do not just refer to images. Below is an audio file that has been compressed with lossy compression. Data has been removed so the audio quality has decreased.

197 KB

81 KB

43 KB

Compression Ratios

Original File Size

Compression Ratio =

Compressed File Size

4 Mb

= 5:1

20 Mb

Example: A file has been compressed from 20 megabytes down to 4 megabytes. This is a compression ratio of 5:1.

To calculate the size after compression, divide the original size by the first ratio value, then multiply it by the second value. For example, the new size for file 1 is (210 ÷ 10) x 3 = 63 MB.

Triple-click the final column to see the right answers.

Questo's Questions

4.8 - Compression:

 

1. Describe 3 benefits of compressing a file[3]

 

2. Describe the differences between lossy and lossless compression[4]

3. A student needs to compress a Microsoft Word document to send in an email. Suggest which type of compression they should use and why. [2]

4a. A text file was 72 KB and was compressed to 8 KB. State the compression ratio.

4b. An audio file was 4.5 MB and has been compressed to 0.9 MB. State the ratio.

4c. A 20 MB file is compressed with a ratio of 5:2. What is the size of the compressed file?      [each]

63MB

164KB

96KB

© CSNewbs 2020