Announcement

Collapse
No announcement yet.

Compare two images to determine degree of difference

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Compare two images to determine degree of difference

    I am using IrfanView in a custom Windows desktop app to grab a portion of the screen in order to monitor a condition in another program.

    Code:
    /capture=7=(-1830,40,100,40)
    Until the condition changes, the screengrabs will be identical. I will make my app alert me when the two images are significantly different (say, 15% different) and when they are totally different (say 80% different).

    Can IrfanView do this via a command-line switch (i.e. compare two images, report % difference)?

    If not, does anyone know of another app that to do this via command-line switches?

    Many thanks!
    Last edited by cssyphus; 03.09.2021, 03:56 PM. Reason: Add post icon and tags

    #2
    I solved this by:

    In Irfanview, using the `/convert=...` CLI switch to also save each screenshot

    eg:
    Code:
    i_view32 /capture=7=(-1830,40,100,40) /convert=c:\outfile1.jpg`
    In DOS, using the built-in Windows/DOS command fc with the /B (binary compare) switch, and capturing the output

    eg:
    Code:
    fc /B c:\outfile1.jpg c:\outfile2.jpg
    Each iteration of the while loop, I delete one or the other file and re-run i_view's capture to that file, then re-compare. When "no differences found" is no longer in the output, I know the condition has changed.

    The language I used to do this is WinBatch, a drastically undervalued IT tool that's been around since 1991.

    Comment

    Working...
    X