Compression

  • Compression is the process of encoding data more efficiently to achieve a reduction in file size.
  • Compression is done by using compression algorithms (formulae) that rearrange and reorganize data information.
  • By encoding information, data can be stored using fewer bits.This is done by using a compression/decompression programs.
  • There are two types of compression losses, Lossless and Lossy compression.



Data Compression Losses :

  1.Lossless Compression :
  • In Lossless Compression the compressed data is reconstructed and the original data is obtain without any loss of information.
  • Lossless data compression is used in ZIP fileformat and in the GNU tool gzip and in many applications.
  • Lossless compression is used in cases where it is important that original and the decompressed data be identical.
  • Typically it is used in executable programs text documents and in source code. Some image file formats, like PNG or GIF use only lossless compression.

  2.Lossy Compression :
  • In Lossy Compression the compressed data is reconsructed and the approximation of original data is obtain and loss of information occured.
  • The original data cannot be recoverd exactly as it was before it was compressed.
  • It is most commonly used to compress multimedia data(audio, video and images) because our eyes cannot distinguish subtle changes.
  • The methods used in lossy compression are JPEG(compress pictures and graphic), MPEG(compress video), MP3(compress audio).

Lossless vs Lossy Examples :




Advantages of Compression :
  • Storage Space :Compressing data files allows you to store more files in the storage space you have available.
  • Transfer Speed :Compressed files contain fewer "bits" of data than uncompressed files,then the time taken to download file will be fast.
  • Cost : The costs of storing your data are reduced by compressing your files for storage because you can store more files in your available storage.

Disadvantages of Compression :
  • Memory Issue :when you uncompressing a file , your computer uses any free memory to complete the task .Then errors will come if you doesn't have enough memory.
  • File Transfer : If you send a compressed file to someone else via internet, that person may not be able to open the file if they don't have a program to uncompress it.
  • Viruses and Malware : Your computer's anti-virus program may not be able to scan a compressed file for viruses and other malware,resulting in your computer being exposed to files that may contain viruses,Trojans, spyware and other harmful programs.

Data Compression Examples :