Menu

Compression

Compression

Compression is the process of reducing the size of a file so that it is stored using fewer bits. A bit is a single binary digit, either 1 or 0, and every file is stored as a pattern of bits, so using fewer bits means there is less data to store.

A compressed file is not in a form you can use straight away. It must first be decompressed — turned back into a normal, usable file by the software that opens it. A compressed picture cannot be shown on screen, and a compressed game cannot be loaded and played, until it has been decompressed.

Two types of compression

There are two types of compression, and they treat the data in opposite ways. Lossy compression discards some data, and that data cannot be recovered — the file itself still opens and works, but the details that were thrown away are gone for good. Lossless compression keeps every piece of data and only stores it more efficiently.

TypeWhat happens to the dataAfter decompressingQuality
LossySome data is thrown away and never comes backAn approximation of the originalLower than the original
LosslessNo data is thrown awayExactly the same as the originalIdentical to the original

Imagine a student films the school science fair on a tablet. Compressing the video lossily might throw away quiet background sounds and slight differences in colour that you barely notice while watching, so the file shrinks a long way — but once that data has gone, decompressing can never bring it back. Compressing the same video losslessly keeps every sound and every shade, so decompressing gives back exactly the video that was filmed, although the file does not shrink as far.

Practise this