Skip to content
All posts

A quick dive into lossless and lossy compression

Lossy or lossless? It can be hard to know what type of compression you need for the task in front of you. Sometimes lossy compression might be the way to go, but other times nothing but lossless will do. How do you decide?

First, a quick round-up of what's what. Lossy compression permanently removes extra information from a file, with the goal of trimming only what won't be noticeable to the human eye or ear. Files end up smaller, but they're lower-precision. Lossless compression is compression that is able to precisely rebuild the original file during decompression. No information is lost, but compressed file sizes usually aren't as small as you get with lossy compression.

Let's start with lossy compression. When you choose to save your photo as a JPG, you're choosing a lossy type of compression – the photo will have a very small file size, but you've permanently stripped out some of its detail. If you zoom in on a JPG file, you'll start to notice pixelation. Lossy formats can be useful for images on a website, where a quick load is critical and you aren't expecting users to zoom in closely to inspect the detail of your image. Same with other types of media. Using lossy file formats for video and audio can make your media assets quicker to load or share without sacrificing noticeable quality.

But lossy compression has its downsides, and there are times that it's just not an option. For instance, lossy compression removes some information, and it’s not recoverable. The detail you’ve sacrificed for a small file size is lost forever. But it’s not only that; removing information can have devastating effects on the accuracy of text documents, spreadsheets, or any file that carries detail that can’t get lost.

When you need to preserve exact information, you'll want to use lossless compression. Text files, for example, need to be compressed losslessly to make sure there are no mistakes introduced during decompression. Imagine the difference between "uniformed" and "uninformed" and you'll understand why a flub in lossy file reconstruction could break your annual report document (and ruin your day). Lossless compression is needed anywhere precision is critical. Spreadsheets with numerical data, documents, archives, and system files all are best suited to lossless compression. Some types of media files are, too, especially ones that might need to be enhanced or zoomed in. Medical images, for example, need to be able to be decompressed with 100% integrity.

CompressionX is a lightning-fast, secure way to compress losslessly. And with CompressonX's ability to make some files 65% smaller, we're resetting expectations for how small you can go with lossless compression.

 

References:

  • https://cs.stanford.edu/people/eroberts/courses/soco/projects/data-compression/overview/index.htm
  • https://www.cs.cmu.edu/~guyb/realworld/compression.pdf
  • https://ui.adsabs.harvard.edu/abs/2022EGUGA..24.1149K/abstract
  • https://www.adobe.com/uk/creativecloud/photography/discover/lossy-vs-lossless.html