Here you can find the source of imagesEqual(File file1, File file2)
public static boolean imagesEqual(File file1, File file2) throws IOException
//package com.java2s; import java.io.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class Main { public static boolean imagesEqual(File file1, File file2) throws IOException { BufferedImage image1 = ImageIO.read(file1); BufferedImage image2 = ImageIO.read(file2); int columns = image1.getWidth(); int rows = image1.getHeight(); for (int row = 0; row < rows; ++row) { for (int col = 0; col < columns; ++col) { int rgb1 = image1.getRGB(col, row); int rgb2 = image2.getRGB(col, row); if (rgb1 != rgb2) { return false; }/*from w w w . ja va 2 s . c o m*/ } } return true; } }