Here you can find the source of equals(final BufferedImage image1, final BufferedImage image2)
public static boolean equals(final BufferedImage image1, final BufferedImage image2)
//package com.java2s; /*/*from w ww . ja va2s. co m*/ * Copyright 2012 Alexey Ivanov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; public class Main { public static boolean equals(final BufferedImage image1, final BufferedImage image2) { final int width1 = image1.getWidth(); final int width2 = image2.getWidth(); if (width1 != width2) { return false; } final int height1 = image1.getHeight(); final int height2 = image2.getHeight(); if (height1 != height2) { return false; } for (int i = 0; i < width1; ++i) { for (int j = 0; j < height1; ++j) { if (image1.getRGB(i, j) != image2.getRGB(i, j)) { return false; } } } return true; } }