b2KIT

Image Quality Comparison

Compare image quality at different compression levels with SSIM scoring.

Tested tool guide Tested browser tools Checked August 16, 2026

What Image Quality Comparison does, with a checked example

SSIM answers one question: after you re-encode an image, how far has it drifted from the original? Drop the original and a compressed copy (a JPEG export, a WebP conversion, a resized file) into this tool and it compares them with the Structural Similarity Index, which measures luminance, contrast, and local structure window by window and averages the results into a single score where 1.0 means indistinguishable. The surprise is how low good scores sit: 0.98 is typical for compression already visible on smooth gradients, not a sign of trouble. Everything runs locally; nothing is uploaded.

Worked example

A concrete input and expected output from the current implementation.

Input

Two images to compare: an original 2x2 grayscale block with pixel values (50, 60, 70, 80) and its recompressed copy (52, 58, 72, 78).

Expected output

SSIM ~ 0.986. Both blocks have mean 65; with L = 255, K1 = 0.01, K2 = 0.03, the score is (2*65*65 + 6.5025)(2*115 + 58.5225) / (65^2 + 65^2 + 6.5025)(125 + 109 + 58.5225) = 2,439,891 / 2,473,717 = 0.9863.

The compressed block keeps the same mean, so the luminance term is exactly 1, and the small perturbations (+2, -2, +2, -2) only narrow the variance (125 to 109), which drags the score just below 1. Any faithful SSIM implementation scores these two blocks near 0.99; windowed implementations differ only slightly on a block this small.

How the result is produced

1

What the score computes

SSIM does not compare pixels directly. In each of many small sliding windows it estimates three things about the two images: luminance (window means), contrast (window variances), and structure (the covariance between them), then combines the three with the stabilizing constants C1 = (0.01L)^2 and C2 = (0.03L)^2, where L = 255 for 8-bit images. The reported score is the average over all windows; identical images score 1.0.

2

What the two inputs must be

SSIM is a full-reference, position-by-position comparison: each window in the first image is compared only with the window at the same location in the second. Both images must share the same pixel dimensions, and the original must be present, since the score means nothing without it. Compare a 4000 px original with a 2000 px copy and the output is noise.

Good uses

  • Pick a compression level: export a photo at several JPEG or WebP quality settings, score each against the original, and take the smallest file whose score stays above the threshold you have settled on.
  • Audit a conversion pipeline: after batch re-saving or reformatting images (metadata strip, color-profile change, a new exporter), compare a sample of outputs with the sources to catch unintended changes that a quick eyeball pass would miss.
  • Compare resizing methods: downscale a photo with two algorithms, upscale both results back to the original dimensions, and score each against the source to see which one loses less detail.

Limits and checks

  • Mismatched dimensions produce garbage: SSIM compares window to window at the same position, so a resized or cropped copy must be brought back to the original pixel dimensions before the score means anything.
  • The average can hide localized damage: the reported score is the mean over all windows, so a ruined face or garbled text occupying a small fraction of the frame moves the number only slightly. A score of 0.99 does not guarantee the whole image survived; zoom into areas of interest as well.
  • Scores do not travel across images: fine texture and sensor noise push every comparison down, so a given score means different things on a smooth sky than on grass or foliage. Use SSIM to rank candidates derived from one original, not to grade unrelated images against each other.

Common questions

What score means the compressed version is visually lossless?

There is no universal threshold. Photographs typically look clean around 0.98 to 0.99, while text, screenshots, and smooth gradients show damage at the same numbers because the score averages across the whole frame. Decide your own cutoff by looking at a few results, then use it to rank candidate settings.

Does a score of 1.0 mean the files are byte-identical?

Practically, yes: a full 1.0 requires the means, variances, and covariances to match in every window, which real files reach only when their pixel data is identical or nearly so. The reverse is the trap: 0.99 can still hide a small region that is visibly ruined.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools