Here you can find the source of compareImages(BufferedImage imgA, BufferedImage imgB)
public static boolean compareImages(BufferedImage imgA, BufferedImage imgB)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { public static boolean compareImages(BufferedImage imgA, BufferedImage imgB) { if (imgA.getWidth() == imgB.getWidth() && imgA.getHeight() == imgB.getHeight()) { int width = imgA.getWidth(); int height = imgA.getHeight(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { if (imgA.getRGB(x, y) != imgB.getRGB(x, y)) { return false; }// ww w. j a v a 2 s .c o m } } } else { return false; } return true; } }