File Compression

Image result for file compression
Each day we deal with tons of files and pictures and we come across different formats some of them are compressed, which means they have smaller sizes such files including (zip, rar etc). But have you ever asked yourself how compressed files work?

File compression is a way for reducing the size of the files to make it less expensive for storing and transferring data. The two most common ways of compression are:

  • Lossless compression 
  • Lossy compression 

So you might ask what’s the difference and what type of compression am I using? to answer this question let's get into each one of them.

Lossless compression: 

The main idea behind Lossless compression is to reduce redundancy in the data itself. To give a better understanding suppose that you have the following example: eeeoyyyywwww => e3o1y4w4

This is the simplest form of Lossless compression, there are many other forms that include math equations. In Lossless compression, you don’t lose any of the original data so you can decompress your files to get the original file. Also, file formats like .ZIP or images with .PNG format uses this algorithm. 

Lossy Compression: 

In Lossy Compression the idea is to remove some of the data while keeping the rest in an understandable form, for example, if we take a look at this picture you can see the difference in quality due to the removal of the data:

As you can see the picture to the left lost some data which resulted in losing so some of its quality. When using Lossy Compression you won't be able to restore the original file due to the loss of the data, this type of compression is used in media content like .mp3 or .JPEG.

In conclusion, file compression helped us improve the way we communicate and share data by reducing the size of the data itself however what compression should be used for depends on the criteria and the requirements needed.

Post a Comment