What is data compression?

Share

Data compression is a reduction in the number of bits needed to represent data. We can save storage, decrease the cost for storage hardware, and speed up the file transfer all by compressing data.

Imagine that you have a file of 150Mb. We could shrink it down to 30Mb, but we have to compress it with a compression ratio of 5. Likewise, If we have compressed 16Mb to 4Mb, it would have a compression ratio of 4 because the new compressed file is a 4th of the size of the original file. The higher the compression ratio, the more compression there is.

There are two types of compression

1. Lossy compression

Lossy compression reduces the file size by removing unnecessary bits of information. It is generally used on images, audio files, and videos, in which perfect representation of media is not necessary.

2. Lossless compression

Lossless compression allows the file to regain its original position without losing a single bit of information when the file is uncompressed. Lossless compression is used to compress data files (such as Numerical data, Executable code, Text files) because programs that process such data files cannot accept mistakes in the data.

Advantages of data compression

  • Faster reading and writing.
  • It occupies less storage space.
  • File transmission takes place faster.

Disadvantages of data compression

  • Added with complications.
  • Effect of transmission errors.