teach-ict.com logo

THE education site for computer science and ICT

3. Lossy compression

If file size is an issue, then it may be acceptable to disregard some of the original information. That way, less data needs to be stored. This is called 'lossy compression'.

Lossy compression depends on patterns being present within the information, as mentioned on the previous page. The algorithm looks at the data, tries to identify the patterns and decides how much it can throw away without noticeably affecting the quality of the data.

Different file types can be compressed to different amounts. Some information can be safely discarded, while other information may be essential to retain.

For example a document needs to store every character. Imagine the word fury and furry in a sentence, they mean something completely different - yet they are only one character different - you cannot afford to lose that single character.

On the other hand a music file will have sounds at frequencies that the human ear cannot hear. Those frequencies can be safely discarded without the listener ever noticing their absence.

Here is an example of lossy compression using images:

 

sunset image

File size 75Kb

Quality set to 100%

sunset compressed

File size 13Kb

Quality set to 45%

Would you say that the 45% quality jpeg is much worse than the 100% quality one?

It is slightly more blurry, but probably not enough to matter in most circumstances. But losing the information has resulted in the file size being reduced from 75Kb down to 13Kb. This means it would take up a lot less storage space on your device and also, if you were opening a web-page, it would render 5 times faster.

For a video file this is even more significant. Perhaps a film would take an hour to download in uncompressed format whilst a well-compressed version would be five times quicker (12 minutes).

Here are some very popular lossy compression standards for music, image and video

  • Music : MP3 files
  • Image: JPG files
  • Video: MP4 files

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: What is lossy compression