Main content
AP®︎/College Computer Science Principles
The need for compression
Modern computers can store increasingly large numbers of files, but file size still matters. The smaller our files are, the more files we can store.
We use compression algorithms to reduce the amount of space needed to represent a file.
There are two types of compression: lossless and lossy.
Lossless compression algorithms reduce the size of files without losing any information in the file, which means that we can reconstruct the original data from the compressed file.
Lossy compression algorithms reduce the size of files by discarding the less important information in a file, which can significantly reduce file size but also affect file quality.
We'll first explore lossless compression techniques that work for text documents, simple images, and all binary data, and then explore lossy compression techniques for photos and audio.
Want to join the conversation?
- In lossy compression what do you mean by discarding less important information? In an .JPEG or any image related file extension i could understand that those files when they're reduced they lose quality, but what about like documents?(5 votes)
- Lossy compression involves removing less important information and so this allows compression of files like audios, pictures or videos since the lost information might be unnoticeable but for documents, lossy compression cannot be used since it can lead to missing of some characters hence making the document unreadable so for documents only lossless compression works(15 votes)
- How on earth is this so confusing, yet understandable? To me its kinda a teeter-toter of I understand this, to I have no clue....(6 votes)
- In Lossy compression, what do you mean when they reduce file size.(2 votes)
- The number of bytes in the compressed file is smaller than the number of bytes in the original file.(2 votes)
- How can we reconstruct the original data? Why don't people just use lossless compression?(1 vote)
- Losslessly compressed files usually contain some sort of table that allows the original file to be reconstructed.
You usually won't notice the loss of quality in images and videos caused by lossy compression and lossy compression tends to give better compression ratios than lossless compression.(3 votes)
- what is your favorite candy?(2 votes)
- how do you make information smaller and compress it even though theres a lot in lossless? how can it be made smaller with the same amount of info(1 vote)
- Lossless compression describes data in a different way that takes up less memory. For example, instead of explicitly stating the series of numbers "1, 4, 9, 16, 25, 36, 49, 64, 81, 100", we could say "x^2 for 0 < x < 11". The two descriptions are equivalent, but the second is smaller.(2 votes)
- How many 1101010110 bytes long is this?(1 vote)
- The number you provided has 10 bits. A byte has 8 bits. So your number is 1 byte with 2 bits left over.(1 vote)
- What are some techniques?(1 vote)
- what can bits do(1 vote)
- I want to study from videos... can't I learn from videos(0 votes)