efficient way to compare 2 images?
#24
This worked for me. I made a copy of an instagram icon and changed the name. I compared the original to the one with the changed name to see if the name change would affect the results. It did not. This is a very fast method, but sure, you'd have to look into any particulars that it might not be reliable.

For now, if you are curious, here is how it's done.

Code: (Select All)
IF _FILEEXISTS("instagram_icon.jpg") THEN
    OPEN "instagram_icon.jpg" FOR BINARY AS #1
    a$ = SPACE$(LOF(1))
    GET #1, , a$
    CLOSE #1
    PRINT LEN(a$)
END IF

IF _FILEEXISTS("junk-for-qb64-test.jpg") THEN ' This is a renamed copy of the instigram icon.
    OPEN "junk-for-qb64-test.jpg" FOR BINARY AS #1
    b$ = SPACE$(LOF(1))
    GET #1, , b$
    CLOSE #1
    PRINT LEN(b$)
END IF

IF LEN(a$) AND LEN(b$) THEN
    IF a$ = b$ THEN PRINT "Same Image" ELSE PRINT "Different Image"
ELSE
    PRINT "An image couldn't be found."
END IF

Pete
If eggs are brain food, Biden takes his scrambled.
Reply


Messages In This Thread
efficient way to compare 2 images? - by madscijr - 11-18-2022, 07:51 PM
RE: efficient way to compare 2 images? - by bplus - 11-18-2022, 08:10 PM
RE: efficient way to compare 2 images? - by Pete - 11-18-2022, 08:26 PM
RE: efficient way to compare 2 images? - by Pete - 11-18-2022, 08:55 PM
RE: efficient way to compare 2 images? - by Pete - 11-18-2022, 09:30 PM
RE: efficient way to compare 2 images? - by Pete - 11-18-2022, 09:52 PM
RE: efficient way to compare 2 images? - by Pete - 11-18-2022, 11:08 PM
RE: efficient way to compare 2 images? - by bplus - 11-18-2022, 11:40 PM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 12:22 AM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 01:22 AM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 05:39 PM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 06:28 PM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 10:54 PM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 11:54 PM
RE: efficient way to compare 2 images? - by bplus - 11-19-2022, 11:57 PM
RE: efficient way to compare 2 images? - by bplus - 11-20-2022, 12:02 AM
RE: efficient way to compare 2 images? - by bplus - 11-20-2022, 12:14 AM
RE: efficient way to compare 2 images? - by bplus - 11-20-2022, 12:36 AM
RE: efficient way to compare 2 images? - by bplus - 11-20-2022, 02:37 AM



Users browsing this thread: 24 Guest(s)