If a .zip file contains all of the information of the original, just in less space, why does it have to be unzipped to access any of it?

848 views

If a .zip file contains all of the information of the original, just in less space, why does it have to be unzipped to access any of it?

In: 1276

43 Answers

Anonymous 0 Comments

There is no way to compress a 12-digit number into a 8-digit number, in general. What you _can_ do is find a method that e.g. compresses some 12-digit numbers into 8 digits, and expands some others into 14 digits. That’s what “all of the information but in less space” really means – you found, say, a reversible mapping from 12 digits to 6-20 digits.

Actual compression algorithms are chosen such that usual data like English text or a photo gets compressed, unusual data you don’t care about like gibberish or pure noise gets expanded. I say “unusual”, but that refers to the source where the data came from, such as a camera – for every “usual” file, there are many, many more “unusual” ones. For example, if you randomly reorder the pixels of a 16×16 image, you get about 256! ≈ 10^(507) images, and most of those look like uniform noise and are not going to come up naturally.

Anyway, some compression algorithms exist that allow you to decompress only certain files, or parts of a file, but even in that case, a decompression process needs to happen first – the information itself is encoded in a complicated way, to a format that isn’t directly readable.

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