BlogImage Compression

Lossless vs Visually Lossless Image Compression: What's the Difference?

Understand the real difference between lossless and visually lossless image compression — what each term means technically, how quality is measured, and when to use each method for photography, web, archival, and professional workflows.

Updated: June 3, 2026

Lossless compression preserves every pixel exactly — the decoded image is mathematically identical to the original. Visually lossless compression removes some image data, but the result looks the same to a human viewer under normal viewing conditions. The gap between them is not subjective opinion; it is a measurable difference in bit-level accuracy versus perceptual transparency.

If you need to archive a master file, edit it later, or prove that nothing changed, you need true lossless. If you need the smallest possible file for a website, app, or social platform — and the image just needs to look right — visually lossless is almost always the better trade-off.

Quick Comparison

AspectLosslessVisually Lossless
Pixel accuracyBit-for-bit identical to originalClose, but not identical
Human perceptionIndistinguishable from originalIndistinguishable under normal viewing
File size reductionModest (typically 10–40%)Significant (typically 50–90%)
ReversibilityFully reversible — original can be restoredNot reversible — removed data is gone
Common formatsPNG, FLAC (audio), TIFF (LZW), WebP lossless, AVIF lossless, JPEG XL losslessHigh-quality JPEG, WebP lossy, AVIF lossy, JPEG XL lossy, HEIC
Typical useArchiving, editing masters, medical imaging, legal evidence, logosWeb publishing, social media, streaming, email, app assets
Quality metricsPerfect by definition (PSNR = ∞, SSIM = 1.0)PSNR typically > 40 dB, SSIM > 0.985

What Lossless Compression Actually Does

Lossless compression does not discard any information. It reduces file size by finding more efficient ways to represent the same data.

The core techniques are:

  • Run-length encoding: Replaces sequences of identical values with a count. A row of 200 white pixels becomes "white × 200" instead of 200 individual entries.
  • Dictionary-based encoding (LZ77, LZW): Scans for repeated patterns and replaces each repeated occurrence with a short reference back to the first one.
  • Entropy coding (Huffman, arithmetic coding): Assigns shorter binary codes to more frequent values and longer codes to rare ones, reducing the overall bit count.

PNG is the most familiar example. It applies a prediction filter (to make the data more compressible), then compresses the filtered data with DEFLATE — a combination of LZ77 and Huffman coding. The result is a smaller file that decompresses into the exact original image, pixel for pixel.

The limitation is clear: lossless compression can only exploit redundancy that already exists in the data. A noisy photograph has very little redundancy, so lossless PNG files for photos are often larger than high-quality JPEG files that look just as good.

What "Visually Lossless" Really Means

"Visually lossless" is not a gimmick or a marketing term — it is a specific quality category with measurable thresholds.

A compressed image is considered visually lossless when:

  1. A human viewer cannot reliably distinguish it from the original under normal viewing conditions (typical screen, typical distance, no zooming).
  2. Objective quality metrics fall above established thresholds: MSSIM (Multi-Scale Structural Similarity) greater than 0.985, or PSNR-HVS-M greater than 40 dB, as shown in peer-reviewed research on visually lossless image compression.

These thresholds were not invented by codec vendors. They come from formal subjective testing — the same methodology used in ISO/IEC standards — where trained and untrained viewers are shown original and compressed images side-by-side or in rapid alternation (flicker test). When the vast majority of viewers cannot reliably identify which is which, the compression is classified as visually lossless.

The key distinction: visually lossless does not mean "sort of close." It means indistinguishable to the human eye in the conditions where the image will actually be seen.

How the Two Methods Measure Quality Differently

This is where most explanations oversimplify. The difference between lossless and visually lossless is not just "one keeps data, the other doesn't." It is a difference in what counts as quality.

Lossless quality: binary and absolute

For lossless compression, quality is a simple yes-or-no question: after decoding, does every pixel value match the original? There is no room for debate. You can verify this with a checksum (MD5, SHA-256) or a binary diff. If even one bit differs, the compression is not lossless.

Visually lossless quality: perceptual and contextual

For visually lossless compression, quality is measured against human perception, not against the original data. The metrics used include:

MetricWhat It MeasuresVisually Lossless Threshold
PSNR (Peak Signal-to-Noise Ratio)Ratio between maximum possible signal and compression noise> 40–45 dB
SSIM (Structural Similarity Index)Perceived change in structural information, luminance, and contrast> 0.95–0.99
MSSIM (Multi-Scale SSIM)SSIM evaluated at multiple image scales> 0.985
PSNR-HVS-MPSNR weighted by human visual system sensitivity> 40 dB
VMAF (Video Multimethod Assessment Fusion)Netflix-developed metric combining multiple quality indicators> 90–95

These metrics correlate with human judgment but are not perfect. Two different images compressed to the same PSNR can look very different in quality, which is why SSIM and its variants (which consider structural similarity rather than pixel-level error) are preferred for evaluating visual losslessness.

When Each Method Breaks Down

Understanding the limitations is more useful than memorizing definitions.

When lossless compression disappoints

  • Photos with fine detail and noise: Lossless compression achieves very modest size reductions — sometimes only 10–20%. A 10 MB RAW photograph might compress to 8–9 MB as lossless PNG, but could look identical as a 1–2 MB visually lossless JPEG or WebP.
  • Real-time delivery: If you are serving images to a website or app, the larger file sizes of lossless compression directly translate to slower load times and higher bandwidth costs.
  • Storage at scale: A photo library with 10,000 images stored losslessly might use 80 GB; the same library at visually lossless quality might use 10 GB.

When visually lossless compression fails

  • Re-encoding (generation loss): Each time a lossy-compressed image is re-encoded, quality degrades further. A visually lossless first encode can become visibly degraded after 2–3 re-encoding cycles. This is why intermediate editing files should always use lossless or uncompressed formats.
  • Professional color grading and post-processing: Color corrections, tone mapping, and other adjustments amplify compression artifacts that were invisible in the unmodified image.
  • Forensic or legal use: Any scenario where you need to prove that an image has not been altered. Visually lossless compression has altered the image — it just looks the same.
  • Medical imaging: DICOM standards often require lossless or near-lossless compression because diagnostic accuracy depends on pixel-level precision that visual evaluation cannot guarantee.
  • Pixel-level comparison: If two images will be compared at the pixel level (e.g., before/after analysis, diffing tools), visually lossless compression introduces differences that will appear as changes.

Which Formats Support Each Mode

Not all formats offer both options. Some are inherently lossy or inherently lossless.

FormatLossless ModeVisually Lossless (Lossy) ModeNotes
PNG✅ Native❌ Not supportedLossless only. "Optimized PNG" tools that reduce file size further (like TinyPNG) actually apply lossy quantization — they just store the result in PNG.
JPEG❌ Not supported✅ NativeBaseline JPEG used on the web is inherently lossy; lossless JPEG-related standards (JPEG-LS, JPEG 2000) exist but are separate and rarely used for web delivery.
WebP✅ Supported✅ SupportedOffers both lossy and lossless encoding. Lossless WebP is ~26% smaller than PNG, per Google's benchmarks.
AVIF✅ Supported✅ SupportedBased on AV1 intra-frame coding. Excellent lossy compression; lossless mode available but less commonly used.
JPEG XL✅ Supported✅ SupportedSupports lossless, lossy, and a unique "modular" mode. Can losslessly recompress existing JPEG files to ~20% smaller.
HEIC/HEIF❌ (rarely)✅ NativeBased on HEVC. Primarily lossy. Lossless mode exists in the spec but is rarely supported in practice.
TIFF✅ (LZW, ZIP)Container format. Lossless when using LZW or ZIP compression. Can also store uncompressed data.

How to Decide: A Practical Framework

Instead of memorizing rules, use this decision flow:

Step 1: Will this image be edited, re-encoded, or used as a master file?

  • Yes → Use lossless (PNG, TIFF, WebP lossless, JPEG XL lossless).
  • No → Go to Step 2.

Step 2: Does the image contain text, sharp lines, transparency, or UI elements?

  • Yes → Use lossless formats (PNG, WebP lossless). Even small artifacts are visible on text and hard edges.
  • No → Go to Step 3.

Step 3: Is this a photograph or complex visual for display purposes?

  • Yes → Use visually lossless compression (WebP lossy, AVIF, JPEG at quality 80–92). You will save 50–90% file size with no visible difference.
  • No → Use lossless.

Step 4: Is this for medical, legal, forensic, or scientific use?

  • Yes → Use lossless or uncompressed. Regulatory requirements typically mandate it.
  • No → Visually lossless is appropriate.

Summary by scenario

ScenarioRecommended MethodWhy
Website hero photosVisually lossless (WebP/AVIF)Large visual savings, no visible difference
Product images (ecommerce)Visually losslessFaster page loads improve conversions
Logos and iconsLossless (PNG, SVG, WebP lossless)Artifacts on edges and text are immediately visible
Photography archives and RAW backupsLossless (TIFF, DNG, PNG)Preserve maximum quality for future editing
Social media uploadsVisually lossless (JPEG, WebP)Platforms re-compress anyway; start with a clean high-quality file
Email attachmentsVisually losslessBandwidth and inbox size matter more than pixel perfection
Medical / legal / forensicLossless or uncompressedRegulatory and evidentiary requirements
Print production mastersLossless (TIFF, PNG)Print resolution amplifies artifacts
App UI assetsLossless (PNG, WebP lossless)Pixel-perfect rendering on all screens

The Re-Encoding Problem: Why It Matters

One of the most misunderstood risks of visually lossless compression is generation loss.

When you open a lossy-compressed image, edit it, and save it again with lossy compression, the quality degrades in two ways:

  1. Existing artifacts are preserved and amplified. The first compression introduced subtle changes. The second compression treats those changes as part of the "original" and introduces new artifacts on top.
  2. Different quantization tables compound. If the second encoder uses a different quality curve, the interaction between the two quantization passes can create artifacts that neither encoder would produce alone.

This is why professionals follow the lossless intermediate rule: keep a lossless master, do all editing on the lossless version, and export to lossy only once, at the end of the pipeline.

If you need a quick tool to apply visually lossless compression to web images without installing software, LessMB supports multiple formats and quality levels in the browser.

Common Misconceptions

"Visually lossless is just lossy compression with a different name." Not exactly. All visually lossless compression is lossy at the bit level. But "lossy" spans a huge range — from barely noticeable to heavily degraded. "Visually lossless" specifically refers to the top end of that range, where human viewers cannot detect the difference. It is a subset of lossy, not a synonym.

"Lossless compression has no downside." The downside is file size. A lossless PNG of a photograph can be 5–10× larger than a visually lossless WebP that looks identical. On the web, that translates directly to slower page loads, higher bounce rates, and poorer Core Web Vitals scores.

"If I can't see the difference, it doesn't matter." It matters if you plan to edit, crop, color-grade, or re-compress the image later. Invisible differences become visible when you push pixels in post-processing. Always keep a lossless original for any image you might need to re-edit.

"JPEG is always lossy and PNG is always better quality." JPEG at quality 90–95 produces results that are visually lossless for many photographs under normal viewing conditions, while achieving file sizes 5–15× smaller than lossless PNG. "Better quality" depends on the content and the use case, not the format name.

FAQ

Is visually lossless good enough for professional photography?

For delivery and display, yes. Professional photographers routinely deliver final images as high-quality JPEG files. But for archiving and editing, keep the lossless original (RAW, TIFF, or lossless DNG).

Can you measure whether compression is visually lossless?

Yes. The standard approach uses SSIM or MSSIM. Research published in the Sensors journal (Ullah et al., 2023) established that MSSIM > 0.985 or PSNR-HVS-M > 40 dB reliably indicates visual losslessness across diverse image content.

Does visually lossless compression work for all image types?

No. It works best for photographs and natural imagery. Images with text, sharp geometric shapes, solid color areas, or fine line art show compression artifacts much more readily. For those, lossless compression is the safer choice.

What happens if I compress a visually lossless image again?

Quality degrades with each re-encoding cycle. This is called generation loss. After 2–3 cycles, artifacts that were invisible in the first pass become noticeable. The solution: always re-encode from the lossless original, not from a lossy copy.

Is there a format that supports both lossless and visually lossless in one file?

JPEG XL can losslessly recompress existing JPEG files into a smaller container while preserving the ability to reconstruct the original JPEG bit-for-bit. WebP and AVIF also support switching between lossy and lossless encoding within the same format, though not within the same file.

Which quality setting should I use for visually lossless results?

It depends on the codec and content, but practical starting points are:

  • JPEG: quality 85–92
  • WebP lossy: quality 80–90
  • AVIF lossy: quality 50–70 (AVIF uses a different scale; 60 in AVIF ≈ 90 in JPEG)

Always compare the compressed result against the original at the intended display size before publishing.

References

  • Ullah, F. et al. (2023). "Subjective Assessment of Objective Image Quality Metrics for Visually Lossless Compression." Sensors, 23(4), 1710. PMC9918960
  • Barina, D. (2021). "Comparison of Lossless Image Formats." arXiv:2108.02557. PDF
  • Google Developers. "Lossless and Transparency Encoding in WebP." WebP Lossless Study
  • ISO/IEC 29170-2. "Information technology — Framework for visually lossless evaluation of coding methods."
  • Adobe. "Lossy vs Lossless Compression." Adobe Photography