Sign in to follow this  
Followers 0
Spacetech

Comparing 2 jpegs from _ScreenCapture_CaptureWnd

5 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

every file is different, because every file contains a different creation date.

So a FileRead wouldn't work? :)

Share this post


Link to post
Share on other sites

every file is different, because every file contains a different creation date.

Thats why I compared the data in the file, not the file header info. Maybe you should try executing code before you comment.

Share this post


Link to post
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
Sign in to follow this  
Followers 0