What’s a Compression Algorithm?

Print anything with Printful



Compression algorithms reduce file size and bandwidth usage by compressing data. They can be classified by dictionary or statistical methods and by being lossless or lossy. Lossless algorithms produce identical files, while lossy algorithms sacrifice some data for smaller size.

Computer files can take up a large amount of space on a hard drive and a lot of bandwidth for transmission. To save space, especially with files that are not often accessed, and bandwidth for transmitted files, archiving methods have been developed to save the data in a smaller package by compressing it in some way. In each case, a compression algorithm is used – a method of reducing the size of the data. There are several popular categories and types of compression algorithms, each of which works differently, and some of which have results that differ in important ways. Using various compression algorithms, it is usually possible to reduce a text file to less than half its original size; for graphic files, the results vary widely. The file that results from the compression can be a different format or an archive file, which is often used for archiving, transmission and distribution.

One way to classify compression algorithms is whether they use dictionaries or statistical methods to compress data. The dictionary method focuses on repeatable sentences and is used in GIF images and JAR and ZIP archives. The statistical method is based on the frequency of use to make a conversion, which is done in two steps. An example is Modified Huffman (mh), used in some faxes.

A second way to classify compression algorithms and the one that amateur programmers most often encounter is whether they are lossless or lossy. A lossless data compression algorithm is one that compresses data in such a way that when it is decompressed, it is exactly identical to the original file. An example of a lossless data compression algorithm is lzw (Lempel-Ziv-Welch algorithm). Developed in 1977 by Lempel and Ziv and improved in 1984 by Welch, it is used in files such as GIF, TIF and PDF, as well as some modems.

A lossy data compression algorithm has the ability to reduce data to a smaller size than lossless compression, but at the cost of some of the original data. In other words, recovery after lossy data compression does not provide an identical copy of the original file. The compression algorithm is, however, designed to limit leaks so they are not obvious to the ear or eye. Lossy compression is used in file formats such as AAC, JPEG, MPEG and MP3.




Protect your devices with Threat Protection by NordVPN


Skip to content