Jump to content

Comparing 2 jpegs from _ScreenCapture_CaptureWnd


Recommended Posts

I use _ScreenCapture_CaptureWnd to screen capture a window every 5minutes. Is their anyway to compare the 2 images and see if they are the same? I have searched the forums and looked for functions but I haven't found anything on this topic.

Link to comment
Share on other sites

You could just do a simple file compare:

If _CompareFiles(@MyDocumentsDir & "\GDIPlus_Image(1).jpg", @MyDocumentsDir & "\GDIPlus_Image(2).jpg") = 1 Then
    ConsoleWrite("+> Files match" & @CRLF)
Else
    ConsoleWrite("-> Files do not match" & @CRLF)
EndIf

Func _CompareFiles ($sFile1, $sFile2)
    Local $hFile1, $hFile2, $bFile1, $bFile2
    $hFile1 = FileOpen($sFile1, 16)
    $hFile2 = FileOpen($sFile2, 16)
    If $hFile1 = -1 Then
        ConsoleWrite('!> Error: Could not open "' & $sFile1 & '"' & @CRLF)
        Exit
    EndIf
    If $hFile2 = -1 Then
        ConsoleWrite('!> Error: Could not open "' & $sFile2 & '"' & @CRLF)
        Exit
    EndIf
    $bFile1 = FileRead($hFile1)
    $bFile2 = FileRead($hFile2)
    If $bFile1 = $bFile2 Then Return 1
    Return 0
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...