compare two images

Posted on 2001-09-18
Last Modified: 2008-02-01
Hai Java Guys,

How to compare two images using java.If any thing different at any place ,we have to give details of that pixel.It is GIS project.If anybody know solution for this plz let me know.Thank you in asdvance.

Question by:shaikchanbasha
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

toffe071900 earned 20 total points
ID: 6489989
i suppose you could use pixelgrabber on both pics to get arrays of the contents and then compare each element in the two arrays


Expert Comment

ID: 6490780
You could simplify it to begin with....

Check the dimensions of the images are the same, if thy're not then you know before you do any more time consuming proccessing that the images arn't the same.

On the other hand if the width and the height are the same in each picture, then you can go on to set up 2 arrays containing the picture information and compare the two togeather.


//Returns true if the images are equal
public boolean imagesAreEqual(Image i1,Image i2)
     if((i1.getWidth()!=i2.getWidth)||(i1.getHeight()!=i2.getHeight)) return false;
     //Grab the two pictures here....
     //and now compare...
     for(int index=0;index<picLength;index++)
          if(pic1[index]!=pic2[index]) return false;
     return true;
LVL 20

Expert Comment

ID: 8916372
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points for toffe

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question