EMZETT.
Login

Compression

In short: Compression makes data smaller so it needs less storage space and is transferred faster. The counterpart is unpacking (decompressing).

In more detail: The methods exploit the fact that data contains repetition and redundancy. One distinguishes whether unpacking restores exactly the original or not.

In Depth

  • Lossless: the original is restored exactly. Examples: ZIP, gzip, PNG, FLAC. Needed for text, programs and documents.
  • Lossy: unimportant details are discarded, the file becomes much smaller. Examples: JPEG (image compression), MP3, H.264 video. The original cannot be recovered, and saving repeatedly degrades quality further.
  • Principle: frequent patterns get short codes (Huffman), or repetitions are replaced with references (LZ77). A simple example: “AAAAAAAAAA” becomes “10×A”.
  • Compression ratio: the ratio of original to packed size. Already compressed data (JPEG, MP4) can hardly be packed further.
  • On the web: servers deliver pages compressed with gzip or Brotli, which saves traffic and load time.

See also: compressing, decompressing, image compression