How does data compression work?

How does data compression work?

Data compression is a process in which the size of data is reduced so that it can be stored and transmitted more efficiently.

There are two major types:Lossy Compression and Lossless Compression.

1. Lossy Compression

In lossy compression, some information from the data is permanently removed thereby reducing the size of the data. This type of compression is commonly used for audio, video and image files where some loss of quality is acceptable.

Examples: JPEG image files, MP3 audio files

Methodology:

Removing redundant data: e.g., removing colors invisible to the human eye in an image.

Transformation technique: Converting data into a form that can be compressed further, such as the use of DCT (Discrete Cosine Transform) in JPEG

2. Lossless Compression

In lossless compression, no information from the data is removed. Data can be fully recovered after compression. This technique is used for important data (such as text files, program files) where any loss of information is not acceptable.

Example: ZIP files, PNG image files

Methodology:

Run-Length Encoding: Representing frequent repetitive parts in data by a code.
Example: Compressing AAAABBBB as 4A4B.
Huffman Coding: Representing frequently used data by small bits and rare data by large bits.
LZ77: Finding patterns and repetitions in data and representing them by pointers.
General Procedure
Getting input data: File or data is taken as input for data compression.
Applying compression algorithm: Appropriate compression algorithm is used according to the type of data.
Outputting compressed data: After the compression process, the size of the data is reduced and it is stored or transferred.

For example compression of ZIP file:

Text file: “AAABBBCCC”

Run-length encoding: “3A3B3C”

Huffman coding: 3A=1, 3B=01, 3C=001

Thus, data compression allows us to store more data in less space and transfer it faster.

 

One thought on “How does data compression work?”

  1. gud to see uh

Add a Comment

Your email address will not be published.