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?

    Not submitting this as an answer as it's probably not a viable solution for photos, but GitHub (a programmer's site) has some interesting ways of comparing images: Try clicking "2-up", "Swipe", "Onion Skin" and "Difference".

  • cabbey

    cabbey Correct answer

    10 years ago

    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

    Newb question, but how to do you do step 4, "create an effect layer atop that"? Can't find it anywhere. It's also 7 years later and I'm using the latest version for perrhaps they've changed the name also?

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM