What are compressed and uncompressed files, how does it all work and why compressed files take less storage?

939 views

What are compressed and uncompressed files, how does it all work and why compressed files take less storage?

In: Technology

27 Answers

Anonymous 0 Comments

Basically compression makes some rules that you can use to re create (uncompress) the file.

In the most basic case, imagine you have a text file that for some reason is like 1,000,000 ‘a’ characters. Instead of storing all 1million, you can store something like ‘1000000a’ which saves a lot of space.

If you had 1000 ‘a’ characters followed by 1000 ‘b’ characters, you might compress the file by writing it as ‘1000a1000b’.

The steps you follow (in this case to count the number of same characters in a row) is called the compression algorithm. There are many different compression algorithms that have different characteristics (for example if you want to compress video or text or audio).

Now in our example, we can recreate exactly the information we started with from our compressed file (it would be pretty useless if we couldn’t read the text after we uncompressed it right?). These are called lossless algorithms.

There are also lossy algorithms, which compress stuff, but you can’t get the exact original back. So for example, let’s say you have the data 123456689. We can write that (approximately) as the formula x=y and then when we uncompress, we would get 123456789 which is almost the same as the original. Examples of lossy compression are jpeg, where the compressed images are less clear than the original (maybe more pixelation, or the colours aren’t the same etc.)

There are many different compression algorithms, suited to different purposes and data types (images, text, audio, video etc), and they can be quite complicated mathematically.

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