Here you can find the source of imagesAreEqual(BufferedImage image1, BufferedImage image2)
public static boolean imagesAreEqual(BufferedImage image1, BufferedImage image2)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { public static boolean imagesAreEqual(BufferedImage image1, BufferedImage image2) { if (image1.getWidth() != image2.getWidth() || image1.getHeight() != image2.getHeight()) { return false; }/*w w w . j av a2 s. c o m*/ for (int x = 1; x < image2.getWidth(); x++) { for (int y = 1; y < image2.getHeight(); y++) { if (image1.getRGB(x, y) != image2.getRGB(x, y)) { return false; } } } return true; } }