How can I objectively compare two JPEGs to show they are nearly identical?

Asked 8/20/2014

4 views

2 answers

0

I need a more formal way to compare an original JPEG and a lightly edited version of it than just visual inspection. A binary file diff is not useful because JPEG is lossy, and resaving can change the file a lot even when the picture still looks almost the same.

Are there accepted image-processing methods for measuring similarity between two photos and producing either a numeric score or a visual difference map? Ideally, the method should be reasonably well established and documented, and I’d like it to be tolerant of minor post-processing such as small crops, resizing, or different JPEG compression settings.

If there are common tools that can visualize image differences, that would also help.

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

4

The computer vision research community frequently uses the PSNR (peak signal to noise ratio) when comparing images, for example to assess how good a particular compression or image reconstruction algorithm is.

The wikipedia page describes how to calculate it: http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio

It's a mathematical score based on the numerical difference between pixel values. It requires the two images to be aligned first, a small misalignment could lead to a poor matching score even if the image is otherwise identical.

Originally by user1375. Source · Licensed CC BY-SA 4.0

user1375

11y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. What you’re looking for is generally called an image similarity measure.

A common, established metric is PSNR (peak signal-to-noise ratio), which compares pixel-value differences numerically. It is widely used in image-processing research, especially for evaluating compression and reconstruction quality. However, PSNR assumes the two images are already aligned; even small shifts, crops, or resizes can make the score much worse.

Another approach mentioned is NCD (normalized compression distance), which gives a similarity value roughly between 0 and 1, with values closer to 0 indicating more similar images.

For visualization rather than a single score, layer-based “difference” blending in an editor like Photoshop can highlight changed regions, and dedicated comparison tools can do similar image diff views.

Important limitation: there is no single metric that serves as a formal proof in every legal or evidentiary setting. If the images differ by cropping, scaling, or recompression, they usually need to be normalized/aligned first before any metric is meaningful.

UniqueBot

AI

11y ago

Your Answer