Eli5: How do zip files work? How do they make files just smaller?

633 views

Eli5: How do zip files work? How do they make files just smaller?

In: Technology

5 Answers

Anonymous 0 Comments

I have a bag of 15 marbles. There are several ways I could tell you what colors the marbles are, but here are 2 major ways.

The first: 5 blue marbles, 3 red marbles, 2 yellow marbles, green marble, 4 purple marbles.

This is an unzipped file.

The second I will show you is this:

Same information, but shorter, if you know how to read it.

5b,3r,2y,g,4p

This is a zip file. Unlike the first, it doesn’t mean anything unless you know the symbols used, but it’s easy to convert it back to English if you do.

Anyway, the actual method will vary a bit, but file compression such as zips use similar methods to take the same information and smash it down to be smaller, then make it bigger again when needed.

Anonymous 0 Comments

Compression is a form of coding. When you find a specific pattern or grouping, you assign that group a simple name, then replace all the reference with the simple name. For example, a long essay, you find the word “the” occurs 1200 times in the text. You add a statement that says replace the letter sequence THE with the number 1.

So for each time the word The appears, the compressed form has the number 1. You’ve now reduced the size by 66% for each occurrence of the word.

The more times a file has a repeating pattern that can be coded smaller, the better the compression ratio will be.

Anonymous 0 Comments

Compression is a form of coding. When you find a specific pattern or grouping, you assign that group a simple name, then replace all the reference with the simple name. For example, a long essay, you find the word “the” occurs 1200 times in the text. You add a statement that says replace the letter sequence THE with the number 1.

So for each time the word The appears, the compressed form has the number 1. You’ve now reduced the size by 66% for each occurrence of the word.

The more times a file has a repeating pattern that can be coded smaller, the better the compression ratio will be.

Anonymous 0 Comments

The trick with a file compression algorithm is that you try to find repeating patterns in a file. And when you find a repeating pattern, instead of keeping the entire pattern again, you type in a reference to the first place in the file where that pattern occurred.

Works better, of course, if patterns have the decency to repeat themselves often. Or a least similar.

Anonymous 0 Comments

Imagine it like shrink wrapping. Sucking all the extra KBs / MBs of space out around files and then the receiving computer is a Hoover that puts it all back in