We all know that we need to compress a large file if want to transfer or send it to someone. But have you ever thought about what happens to a file when it is compressed? How does the size of a file reduce by compressing? What actually is a file compression and is the quality of a file compromised while compressing it?
These are a few questions that we will be talking about, in this post.
What is file compression?
As the name implies, file compression means compressing a file to reduce its size. File size can be reduced up to 90% by restructuring, encoding, or modifying its data, and this is what we call file compression.
Compressing files saves a lot of disk space on your PC and also, you can send a compressed file over a slow internet connection. WinZip, WinRAR, 7-Zip, Zip Archiver, and PeaZip are a few of the most common file compression options.
What happens when you compress a File?
When we compress a file, it is converted into a zipped file and if you are sending a zipped file to someone, the receiver has to decompress (extract) it to open it. After decompressing it they can view the file in its original size.
Types of File Compression
There are two types of compression- Lossy compression and Lossless compression the major difference between the two is that in Lossy compression your data quality is compromised a little and in Lossless compression, your file remains intact. Let’s learn this in a bit more detail.
What is Lossy Compression
In lossy compression, your file is compressed by eliminating the unnoticeable data. This type of compression saves you more space as it reduces the file size significantly, but as mentioned above, in lossy compression, the quality of your file whether it is an image file, audio, or a video file, will be compromised a little. Although, you might not even notice that little change in the quality from your naked eye. A file compressed with lossy compression cannot be restored in its original form after decompression. It is also termed an irreversible compression, which means, that once compressed, you cannot bring the file into its original form (because we actually remove certain data of the file while compressing). You can use lossy compression in images, audio, or video files. Below are two of my images compressed using the lossy compression, see if you can find any difference in the quality.
Unlike the lossy compression, here the unnoticeable data of your file is not eliminated and hence this compression won’t make a significant change in the file size. In lossless compression, only the unwanted data is removed and the main information is encoded in fewer bytes, hence no quality loss. A very common example of lossless compression is the Zip format. In this format, you can compress one or more files into a single location, which makes it easier to transfer. Although, a Zip file might not save you huge disk space. You can use lossless compression on the images, audio, and text files. This doesn’t work for the video files. The best part is that you can view the file in its original form after decompressing it.
As we read above, lossy compression saves you more space as compared to lossless compression, people prefer using lossy compression more for their regular usage. It comes in handy when you have to send a large size image or an audio/video to someone or when you want to print an image. However, if the quality is important to you, you should rather choose the lossless compression method.
Disadvantages of file compression
While we have to compress a large file if we want to save some disk space or to send it to someone over the internet, there are a few small disadvantages too.
- Your anti-virus software might not be able to scan the compressed file for viruses and trojans which may harm your PC.The receiver cannot open a zipped file without having a program to decompress it.Both compressing and decompressing use some memory and the processor of your PC, thus it may make your PC a little slower while the process is done.
Zip files use lossless compression which means the quality of your data is not compromised when compressed in a Zip format. Remember that compressing a file into Zip format might not help you with significant disk space. Windows OS too offers a built-in Zip feature.
Does compressing a file reduce quality?
With lossless compression, there won’t be any loss of quality but if you are using lossy compression, the quality will be reduced a little. A compressed image or video may lose its sharpness and fine details.