Compression means reducing the file size, while trying to keep the compressed file as close to the original file as possible.
This means that less storage will be needed to save the files, and they can be also transmitted more quickly across devices.
There are two types of compression: lossy and lossless.
Table 1 shows the differences between lossy and lossless compression.
Table 1
| Lossy | Lossless | |
|---|---|---|
| Examples | JPEG (image), MP3 (audio) |
PNG (image), WAV (audio) |
| Data loss | Some data is permanently lost, even after decompression. | The file can be exactly decompressed into the original so no data is lost. |
| Quality | This means that the file will be of worse quality than the original. | The file will be of the same quality as the original after decompression. |
| Compression | Can compress files more, leading to lower file sizes than lossless compression. | Cannot compress files as much, leading to higher file sizes than lossy compression. |
Which type of compression would be used on text files and software files?
Lossless: it is not okay for text files and software files to lose data (but it's fine for images and audio).