Lossless
/ˈlɔːsləs/ · adjective · compression
Lossless compression makes a file smaller and keeps every pixel or sample exactly. PNG is lossless.
In more detail
Lossless compression shrinks a file in a way that can be undone bit for bit. Nothing is thrown away, so quality stays the same.
PNG is the common lossless image format. The trade is that lossless files are usually bigger than lossy ones.
How lossless compression works
Lossless encoders look for repetition and patterns, then write them down in a shorter form. Nothing is removed. Decompressing reverses the steps and gets back the exact original, much like opening a ZIP file.
PNG filters each row of pixels and then compresses it. FLAC predicts the next audio sample and stores only the error. The methods differ, but the test is the same: the decoded file matches the source exactly.
When to use lossless
Use lossless compression for logos, screenshots, diagrams, images with text, files you are still editing, source data and anything you will process again. Sharp edges and flat colors often compress well without any visible damage.
Lossless doesn't always mean small. Camera photos, noisy scans and video have lots of fine variation that is hard to describe briefly. A lossless version can be many times larger than a good lossy copy. Keep a lossless master, and make smaller copies for sharing when it makes sense.
Key points
- Lossless compression can rebuild the encoded content exactly.
- It suits master files, repeated editing, text, diagrams and flat-color graphics.
- A lossless file made from a lossy copy still has the lossy copy's damage.