File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Checking if two images are identical Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Checking if two images are identical" Watch "Checking if two images are identical" New topic

Checking if two images are identical

Micho Lee

Joined: Oct 21, 2003
Posts: 14
Is there a way to compare images or image objects in java to see if two images are identical?

Thanks a bunch!
Michael Fitzmaurice
Ranch Hand

Joined: Aug 22, 2001
Posts: 168
Hi Micho
You should be able to read the 2 image files as binary and compare them by performing a checksum on each. See the class for one such checksum mechanism.
Whether or not this is what you want depends on your definition of 'the same'. This method obviously requires them to be absolutley identical in their binary makeup. Perhaps you want some kind of fuzzy logic comparison of the graphical content of the images? If so, I can't think of any easy way to do that.
Hope this helps

"One good thing about music - when it hits, you feel no pain" <P>Bob Marley
I agree. Here's the link:
subject: Checking if two images are identical
jQuery in Action, 3rd edition