Here you can find the source of areBufferedImagesEqual(BufferedImage img1, BufferedImage img2)
public static boolean areBufferedImagesEqual(BufferedImage img1, BufferedImage img2)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { public static boolean areBufferedImagesEqual(BufferedImage img1, BufferedImage img2) { if (img1 == null && img2 == null) { return true; } else if (img1 == null || img2 == null) { return false; } else if (img1.getWidth() == img2.getWidth() && img1.getHeight() == img2.getHeight()) { for (int x = 0; x < img1.getWidth(); x++) { for (int y = 0; y < img1.getHeight(); y++) { if (img1.getRGB(x, y) != img2.getRGB(x, y)) { return false; }/*from w ww. ja v a2s .c o m*/ } } } else { return false; } return true; } }