MyLeoNes™

Compression — Computing, 11–13

Compression makes a file smaller by storing its information more cleverly, so it can be saved or sent using less space.

Packing information tightly

Compression changes how information is packed so the same meaning takes fewer bits. A run of “AAAAAA” might be stored as “six As” instead of six separate letters. Some methods can rebuild the original exactly; others throw away details that people usually do not notice, as with many photos and songs.

Why compress files?

Files used to fill disks and take a long time to travel through slow connections. Compression solves both problems: a smaller file needs less room and less time to send. Engineers developed it by noticing repeated patterns and by measuring which changes to an image or sound people can barely hear or see.

A simple repeated pattern

Take the string “REDREDREDRED”. It has 12 letters, but it is four copies of “RED”. A simple compressor can record “RED × 4”, then store the short pattern and the number four. To restore the text, read “RED”, repeat it four times, and get the original 12-letter string back exactly.

“Compressed means damaged”

This is a reasonable guess because some tiny images look blurry and some audio files lose detail. But compression is not always lossy. A ZIP file can shrink a document and restore every character; JPEG and MP3 usually save more space by removing details. The result depends on the method and on what kind of file it handles.

Photos, music and the web

Your phone often compresses photos before sending them, and streaming services compress music and video so they start quickly. A website may send a smaller image to a small screen and a larger one to a television. When you share a ZIP folder, compression helps several files travel together, but it does not create extra space forever.

Keep exploring

Other languages

Loading MyLeoNes™…