• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
iGuRu

iGuRu

Real-time Technology News. Opinions & Tweaks

  • / news
  • / tools
  • / tweaks
  • / dummies
  • / opinions
  • / support
  • / yourpost
home / dummies / How file compression works

How file compression works

09/08/2019 15:14 by Dimitris

File compression is an essential part of how the web works. It allows us to transfer files that would otherwise require excessive amount of data traffic and time. Whenever you link to ZIP files or view JPEG images, you benefit from file compression.

File Compression - How file compression works

So, you might be asked the question: how does file compression work? Let's take a quick look at what this file means and how it works.

What does compression mean?
Simply put, compressing files (or data compression English data compression) is the act of reducing the size of a file while keeping the original data. This way, the file takes up less space on a storage device and can also be more easily transferred over the Internet or otherwise.

Compress - How file compression works

It is important to note that compression is not infinite. Although it can be done step by step it always has a limit. While compressing a file to a ZIP compression format reduces its original size, you cannot continue to compress the file to reduce it further.

In general, file compression is divided into two basic types: with loss (lossy) and without loss (non-loss). Let's see how they both work.

How File Compression Works: Loss Compression
Loss compression (or compression with loss) reduces file size by removing unnecessary pieces of information. It is more common in image, video and audio formats, where perfect representation of the original source is not necessary. There are many formats, or if you want compression protocols to compress the loss for each type of file (music, image or video). MP3 and JPEG are two popular examples.

An MP3 does not contain all audio information from the original recording. It basically rejects and deletes sounds that people do not hear. Deletes frequencies below 20Hz and above 16000Hz as well as various acoustic harmonics.

You will not notice that they are missing anyway, so removing this information results in a smaller file size with virtually no disadvantage.

music notes - How to compress files

Similarly, JPEG compression removes non-critical portions of images. For example, in a photo containing a blue sky, JPEG compression can change all the pixels in the sky to one or two shades of blue, instead of using dozens of different shades.

However, for each type of file, there is a limit where quality loss due to loss compression is not realized. The lower this limit the more you compress a file, the more noticeable the drop in quality. You may have heard MP3 files with a lot of loss compression from YouTube. For example, compare this high quality track:

With this very compressed version of the same song:

Loss compression is appropriate when a file contains more information than you need for your purposes. For example, let's say you have a huge RAW image file. If you want to print this image on a large poster then you need to maintain this quality for vibrant, crisp, and pixel-free prints. It's useless to upload the RAW file to Facebook.

raw 1 - Πώς λειτουργεί η συμπίεση αρχείων

The image contains so much data that is not visible when viewed on social networking sites. Compressing the image to high quality JPEG deletes some information, but the image looks almost the same to the naked eye.

See comparing popular image formats for a deeper analysis of the subject: When I use JPEG, GIF, or PNG

Loss squeeze in general use
As we have mentioned, loss compression is largely suitable for most forms of social media. Because of this, it is vital for companies like Spotify and Netflix to continually transmit huge amounts of information. Reducing the file size as much as possible while still maintaining quality makes them more efficient. Can you imagine what storage would be required if each YouTube video was stored and streamed in its original uncompressed format?

Great  companies rely too much on file compression to be able to offer extensive services in limited storage.

But loss compression doesn't work so well for files where all the information is critical. For example, using a loss compression in a text file or spreadsheet would result in a corrupted output. You can't really throw anything away without seriously damaging the finished product.

When you save a file with some form of loss, you can often set the quality level. For example, many use a slider to select the quality of a JPEG file from 0-100.

Save as JPEG Low Quality - How file compression works

Saving to something like 90 or 80 percent reduces the file size considerably, with little difference to the eye. But storing in poor quality, such as 10%, or repeatedly storing the same file with little loss will eventually degrade it.

How file compression works: Lossless compression
Lossless compression is one way to reduce the size of the file so that you can perfectly rebuild the original file. Unlike loss compression, no information is thrown away. Instead, lossless compression works by essentially removing the redundant elements.

Let's take a basic example to illustrate what this means. Below is a stack of 10 bricks: two blue, five yellow and three red. This stack is a simple way to visualize these bricks, but there is another way to do this.

Lossless Compression Example Original 1 - How file compression works

Instead of showing the 10 bricks, we can remove everything except one of each color. Then, if we use numbers to show how many bricks of each color there were, we have represented exactly the same piece of information using far fewer bricks. Instead of 10 bricks, we now only need three.

Lossless Compression Example Compressed 1 - How file compression works

This is a simple illustration of how lossless compression is possible. It stores the same information in a more efficient way by removing redundancy. Examine a real file with the following string:

mmmmmuuuuuuuoooooooooooo

It can be compressed in the following, much smaller format:

m5u7o12

This allows us to use seven characters instead of 24 to represent the same data, which is a significant savings.

Lossless Compression in Everyday Use
Windows File Zipped Example - How to compress files

As mentioned above, lossless compression is important in cases where you cannot remove any of the original files. If you're curious about how ZIP files work, read below:

When you create a ZIP file with a program in Windows, you use lossless compression. ZIP file compression is an effective way of saving the file, and when you unzip the file there is all the original information. If you used lossy compression to compress a, for example, executable file, the unzipped version would be corrupted and useless.

Common lossless compression formats are PNG for images, FLAC for sound, and ZIP in general for all files. Lossless video compression is rare because results will take up huge amounts of space.

When to use lossless compression versus lossless compression
muo entertainment digitizeaudio audacity export mpm3 - How file compression works

Now that we've looked at both forms of file compression, you may be wondering when to use one and when. As it turns out, there is no "best" compression format, it all depends on how you want to use your files.

In general, you should use lossless compression when you want a perfect copy of the source material and loss compression when an incomplete copy is good enough. Let's look at another example to understand how to choose the best way to harmoniously.

Say you've just dug up your old CD collection and want to digitize it so you have all your music on your computer. When copying your CDs, it makes sense to use a format like FLAC, which is lossless. This allows you to have an original copy on your computer, which is as good as the original CD.

Later, you might want to put some music on your phone or an old MP3 player so you can enjoy it on the go. You probably don't care about the quality of your music, so you can convert FLAC files to MP3. This gives you an audio file that is still completely understandable but does not take up much space on your mobile device. The quality of MP3 converted by FLAC would be just as good if you were creating an MP3 compressed audio file directly from the original CD.

Worry about compressing files
As we have seen, converting a lossless compressed file into a lossy compression format has no problem. However, you should never convert a lost compression file to a lossless compression format. In general you should be careful about converting one form of compression to another.

Converting a lossy compression file into a second lossless compression is just a waste of space. Remember that loss compresses erase data that is then impossible to retrieve.

format or erase a hard drive - How to compress files

Say you have an MPNNX file size 3 MB. Converting to FLAC can result in an 3MB file, but these 30MBs contain the same sounds as the much smaller MP30 files. Converting back to a lossless format does not "retrieve" the information deleted by MP3 compression.

Finally, as mentioned above, converting one form of loss compression to another (or repeated storage in the same format) will further deteriorate quality. Every time you apply the loss compression, you lose more details. This becomes increasingly noticeable until the file is substantially damaged.

How does compression work? Now you know
We have analyzed lossless and lossless compression and have seen how it works. Now you know how to save a file smaller than its original format and how to choose the best method for your needs.

Of course, algorithms that decide which data to delete in lost methods and how to best store redundant data without loss are much more complicated than we have explained here. There is much more you can discover further on the internet if you are interested.

How file compression works was last modified: August 9, 2019, 3: 44 mm by Dimitris

spread the news

  • Facebook
  • Twitter
  • Reddit
  • Printing
  • Email

Read them Technology News from all over the world, with the validity of iGuRu.gr

Follow us on Google News


Competition: dummiestag: compression, date, https, half, MP3

You May Also Like

Chrome will test HTTPS when loading web pages
Five free software to set a video as wallpaper in Windows 10
Game Cleaner: remove temporary Steam, Epic and uPlay game files to free up space

About Us Dimitris

Dimitris hates on Mondays .....

Previous Post: « Electron (PoC) vulnerable to Skype, WhatsApp, Slack applications
Next Post: Harmony OS: Huawei introduced its operating system »

Reader Interactions

Comment Policy:

IGuRu.gr does not publish the comments immediately. Malicious comments, comments that include ads, or comments that are offensive are deleted without notice. We do not adopt the opinions expressed by our readers.
Your comments will be displayed after approval by the administrators


Leave your comment
Ακύρωση απάντησης

Your email address is not published. Τα υποχρεωτικά πεδία σημειώνονται με *

 

 © 2021 · iGuRu.gr · ☢ · Keep It Simple Stupid Genesis theme

about  ·   get in touch  ·  rss  ·  sitemap  ·  cough

loading Cancel
Could not post post - check your email address!
Email verification failed, please try again
Your blog can not post posts via email.