Where the rest of 100MB file is being kept when it is compressed into 80MB zip file?

863 views

Where the rest of 100MB file is being kept when it is compressed into 80MB zip file?

In: Engineering

5 Answers

Anonymous 0 Comments

It’s still there. Lossless compression – like in a zip file – tries to **remove redundancy** from a file by, more or less, replacing strings with pointers to entries in a “dictionary”.

E.g., if I wanted to compress

the quick brown fox jumps over the lazy dog

I could replace `the` with `1`, the space with `2`, and then assign a number to the other words.

12324252627212829

I could then represent those numbers with some kind of variable-length encoding – the DEFLATE algorithm uses Huffman encoding – so that common strings take up even less space in the output: those `1`, `2` don’t need to always take up 8-32 bits.

Most files contain a lot of redundancy, and as such [they can be compressed quite a bit](https://www.maximumcompression.com/) – English text can be brought down to less than one third the size – but this is why you won’t gain much by compressing already compressed files (which includes most images and audio/video files): compression tries to reduce redundancy, to represent the data more efficiently, but already-compressed files don’t have a lot of redundancy to be stripped away.

You are viewing 1 out of 5 answers, click here to view all answers.