How Lossy Compression Actually Works | Shaznation
← Back to Blog
AI & Software

How Lossy Compression Actually Works

How Lossy Compression Actually Works

Every time you share a photo, stream a song, or watch a video online, something invisible is happening in the background. The file you are seeing or hearing is almost certainly smaller than the original — sometimes dramatically so. Lossy compression is the reason, and understanding how it works changes the way you think about every piece of media you consume.

The core idea behind lossy compression is surprisingly human. It does not simply squeeze data into a smaller space the way a zip file does. Instead, it permanently discards information — but only the information that your eyes and ears are unlikely to notice missing. That is the key distinction: lossy compression is built on models of human perception, not just mathematics.

Take a JPEG image. When a photo is saved in this format, the encoder splits the image into small blocks and applies a process called the Discrete Cosine Transform, or DCT. This breaks each block down into a mix of frequency patterns — essentially describing the image in terms of gentle gradients and sharp edges. The encoder then throws away the high-frequency detail that human vision tends to ignore, particularly in areas of complex texture or low contrast. What remains is reassembled into the file you save. The more aggressively the encoder discards, the smaller the file and the more visible the artefacts become.

Audio compression works on a similar principle. Formats like MP3 and AAC use a technique called perceptual coding. A loud sound at one frequency can mask a quieter sound at a nearby frequency — your ears simply will not register the quieter one. The encoder identifies these masked sounds and removes them. It also strips out frequencies above and below the range most people hear clearly in a given context. The result is a file that can be a fraction of the size of the original WAV, with most listeners unable to tell the difference at reasonable bitrates.

Video compression layers these ideas together and adds a third dimension: time. Formats like H.264 and H.265 do not store every frame in full. They store a complete keyframe occasionally, then record only the differences between that frame and the ones that follow. If a camera is locked on a talking head with a static background, most of the pixels in most frames do not change at all — so they simply are not stored.

Why does this matter for you? Because every setting you touch affects this trade-off. When you export a video, choose an image quality level in an app, or pick a streaming bitrate, you are deciding how much of that perceptual detail to keep. Knowing that the losses are deliberate — not random degradation — helps you make smarter decisions about when quality is worth the extra file size and when it genuinely is not.

It is also worth remembering that lossy compression is a one-way door. Once the discarded data is gone, no software can recover it. That is why working with original, uncompressed files matters if you plan to edit, and why formats like RAW for photos and lossless audio have a real place in a serious workflow — even if the final deliverable ends up compressed anyway.