Sunday 19 November 2017

How can I tell exactly what changed between two images?



For example, for a recent conversation about JPEG compression I wanted to compare pixel for pixel what changed between two JPEGs (one with compression level 100, and one with compression level 95).


How do I generate good visual maps of what changed without tedious custom software programing?



Answer



Photoshop + Layers FTW. (Yes, you can also use the Gimp, or any other editing software with the same functions.)


Start with your base image, in the case above, I used the jpeg quality 100 image.



  1. create a new layer atop it

  2. paste the second image into that layer

  3. set the layer style to "difference" (see left pink arrow in 1st image below)

  4. create an effect layer atop that (Layer>New Adjustment Layer>Threshold)


  5. set the effect to threshold (see right pink arrow in 1st image below)

  6. set the threshold value to 1


In the resulting image, any pixel that is any any way different between the two images will be white. You can adjust it to allow things to be "a little different" by altering the threshold value.


Example showing a LOT of difference between jpeg 92 and 100 from Lightroom. comparing jpeg 92 and 100 from LR with Photoshop layers


Example showing no difference at all between 95 and 100. comparing jpeg 95 and 100 from LR with Photoshop layers


Not that's just showing a binary "changed or not", what if you wanted more detail on how much it changed, say by color channel?



  1. replace the threshold adjustment layer with a curves adjustment layer.

  2. edit the curve


  3. turn on show clipping

  4. grab the input white handle below the lower right corner and drag it over to the left, as far as you can go

  5. slowly move back to the right until you don't see any clipping (the preview image is all black)

  6. turn clipping back off and save the curve change


The brighter the resulting pixels, the more they're different in that color. The downside though is you end up with a lot of grey mud... so sometimes it's easier to just threshold it to see where differences are. That's why I build both and toggle which one is visible.


more descriptive view of the difference


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...