Lossless compression preserves the encoded image information exactly when decoded as specified. Lossy compression stores an approximation. Both can change the file’s bytes. Neither term alone tells you whether an application also resized, recolored or otherwise transformed the picture before encoding it.
That last point matters. A tool can make a lossy edit and then save the result in a lossless format. The final encoding is lossless; the entire journey from the original is not.
Three meanings of “unchanged”
An exact file copy preserves every byte. A different encoding can preserve decoded image samples while changing bytes and size. A visually similar export can change samples in ways that are hard to notice.
Illustrative values, not an encoding benchmark. The sample rows make the distinction concrete.
Same file
What this means
A file hash can confirm exact byte identity.
Same pixels
What this means
Different file bytes can decode to the same samples.
Similar appearance
What this means
This illustrative change may be hard to see, but it is not exact pixel preservation.
These are different acceptance standards. Choose the one that matches your task. For archiving exact evidence, byte identity may matter. For rearranging storage efficiently, decoded-sample identity may be enough. For a web illustration, visible quality at delivery size may be the practical requirement.
| Claim | How to assess it | What it leaves open |
|---|---|---|
| Same file | Compare a cryptographic hash of the bytes | Whether the original itself is trustworthy |
| Same decoded samples | Decode consistently and compare dimensions and values | Display changes caused by profiles or orientation handling |
| Similar appearance | Inspect at matched scale and use appropriate metrics | Small but important local changes |
| Smaller file | Compare byte counts | Every quality and provenance question |
Why a lossless file can be much smaller
Lossless encoders can describe repeated or predictable information efficiently. A simple illustration is a row containing the same value many times. Instead of storing a verbose representation of each occurrence, an encoding can represent the pattern and reconstruct it exactly.
Real formats use more sophisticated methods, but the principle is useful: fewer stored bytes do not always mean fewer preserved samples. Conversely, a complex, noisy image can be harder to compress losslessly because its values offer less predictable structure.
This is an explanation, not a claim that every lossless conversion will make a file smaller. An already efficient source can grow under a different encoder or format.
What lossy compression gives up
Lossy encoding can approximate information to reduce the storage requirement. The visible effect depends on the image, dimensions, encoder and settings. Fine text, edges and textures may reveal changes that a small preview hides.
Consider an illustrative row of values: 10, 20, 30 becomes 11, 19, 30. The result may look similar in context, but the original sequence cannot be recovered uniquely from that approximation. Saving it afterward in PNG preserves the approximate values; it does not recover the missing originals.
That explains why converting a JPEG to PNG does not undo JPEG artifacts. It can avoid an additional lossy encoding step, but it does not reverse the earlier loss.
Lossless encoding is not a promise about the whole app
An export pipeline can rotate, resize, convert a color space, reduce bit depth or flatten transparency before writing a file. A lossless encoder can faithfully store the transformed result.
Ask where the preservation claim starts. “Lossless relative to the pixels passed to this encoder” is different from “pixel-identical to the original upload.” A meaningful product claim should identify the boundary and verify it.
Metadata cleanup adds another layer. Removing records can change file bytes while leaving encoded image data intact. Some presentation records, however, affect orientation or color. Compare both the stored data and the displayed result when those details matter.
How to compare exports for your own task
Keep the source and create candidates from that source, rather than repeatedly re-exporting a lossy copy. Hold dimensions fixed if you want to isolate encoding differences. If resizing is required, treat that as its own decision.
Inspect the output at intended display size, then check important regions at matched zoom. A product label, a face or a line drawing may deserve a stricter rule than a decorative background. Record actual file sizes; do not assume that equal quality-slider numbers mean equivalent output across formats.
For exact preservation, use a consistent decoding and color-handling procedure. Comparing hashes of the compressed files tests byte identity, not pixel identity. Two different lossless encodings can have different file hashes and still reconstruct the same samples.
What compression does not prove
A lossless export does not establish that an image is a photograph. A lossy export does not establish that an invisible watermark disappeared. A small output does not establish that a visual classifier will change its label.
Those are separate questions with separate checks. Choose compression for a clear storage or delivery requirement, and evaluate detection only if it is part of your actual goal. The format comparison turns these distinctions into practical export choices.