The need for compression.
Compression is used to reduce the size of stored files. This helps to reduce the storage space they take up meaning less money needs to be spent on storage. This also makes it faster to download them and more suitable to send
files via email which has an attachment size limit. Compression is also what allows for efficient video streaming.
Types of compression
There are two types of compression:
- Lossy compression
- Lossless compression
Lossy compression
Lossy compression completely removes some data when it compresses the file. It tries to remove data that is unlikely to be noticed. When the file is reconstructed, there will be some data missing from the original. Some
examples of lossy file types are:
- JPEG for images
- MP3 for sound
- MP4 for video
Lossless compression
Lossless compression removes no data. Instead it works by identifying and summarising patterns in the data. When the file is reconstructed, it will be identical to the original. Some examples of lossy file types are:
- TIFF for images
- WAV for sound
- ZIP for compressing all types of files
Comparing lossy and lossless compression
Lossy compression loses some data and reduces the quality of the file but is able to achieve higher rates of compression than lossless compression.
Lossless compression maintains the full quality of the file but compresses
by a smaller amount than lossy compression.
Some files such as text files and program files can only be compressed with lossless compression because to lose any characters may render a file unreadable.