Luminous Landscape Forum

Raw & Post Processing, Printing => Digital Image Processing => Topic started by: PeterAit on March 18, 2022, 10:48:52 am

Title: Comparing two photos pixel by pixel
Post by: PeterAit on March 18, 2022, 10:48:52 am
For reasons that I won't go into, I need to compare two photos to see if they are identical byte-for-byte. It seems that Photoshop would have a way to do this, but I cannot figure it out. For example, subtract one from the other? Thanks in advance.
Title: Re: Comparing two photos pixel by pixel
Post by: Peter McLennan on March 18, 2022, 11:26:20 am
Off the top of my head…put each photo into a separate layer, choose “difference” blending mode.
Title: Re: Comparing two photos pixel by pixel
Post by: Redcrown on March 18, 2022, 12:00:34 pm
Yes, put the 2 images as layers in Photoshop, set the top one to Difference mode. You will see a black image, which tells you nothing. So, display the histogram. Click on the little yellow triangle warning in the histogram window. That warning is telling you the histogram is an estimate. Once clicked, the histogram becomes real.

Read the StdDev value. If it is zero, the images are 100% identical. If not, they are different. If StdDev is below 1.0, the difference is insignificant. To see where the differences are, add a Threshold layer on top. Move the slider to the far left, then slowly nudge it to the right. White means difference, black means identical.
Title: Re: Comparing two photos pixel by pixel
Post by: Guillermo Luijk on March 20, 2022, 01:14:27 pm
Read the StdDev value. If it is zero, the images are 100% identical. If not, they are different. If StdDev is below 1.0, the difference is insignificant. To see where the differences are, add a Threshold layer on top. Move the slider to the far left, then slowly nudge it to the right. White means difference, black means identical.
If the op needs 100% accuracy, i.e. to know if two images are absolutely identical byte per byte, Photoshop rounds to 15-bit any loaded image so it won't be able to distinguish many 1-bit differences.

I would just load them in any language and compare them. In R this is so straightforward as:

img1=readTIFF("img1.tif", native=FALSE, convert=FALSE)
img2=readTIFF("img1.tif", native=FALSE, convert=FALSE)
ifelse(max(abs(img1-img2))==0, "Images are identical", "Different images")

Regards
Title: Re: Comparing two photos pixel by pixel
Post by: Alan Klein on March 20, 2022, 04:20:21 pm
Peter I found this.  Don't know if it helps you.
https://www.thewindowsclub.com/how-to-compare-two-identical-images-in-windows
Title: Re: Comparing two photos pixel by pixel
Post by: PeterAit on March 21, 2022, 10:12:52 am
Thanks for the answers. I found a command line utility FC that does a byte-for-byte, but then I realized that 2 files containing identical images could still have different metadata. The idea that was presented here to load the images as layers and then use the Difference blend mode does the trick.
Title: Re: Comparing two photos pixel by pixel
Post by: digitaldog on March 21, 2022, 11:32:58 am
For reasons that I won't go into, I need to compare two photos to see if they are identical byte-for-byte. It seems that Photoshop would have a way to do this, but I cannot figure it out. For example, subtract one from the other? Thanks in advance.
How to do so in Photoshop:
http://digitaldog.net/files/Apply_Image.pdf
Quote
If the images were truly 100% identical, every pixel in the image would be a solid level 128 gray as seen below from the Histogram using Levels. Pixels that aren’t level 128 gray are different by the amount they depart from 128 gray. You can use Levels to exaggerate the difference, which makes patterns easier to see. Just move the sliders on either side to the center as far as you can.