Java BufferedImage Equal imagesAreEqual(BufferedImage image1, BufferedImage image2)

Here you can find the source of imagesAreEqual(BufferedImage image1, BufferedImage image2)

Description

images Are Equal

License

Open Source License

Declaration

public static boolean imagesAreEqual(BufferedImage image1, BufferedImage image2) 

Method Source Code


//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;
    }
}

Related

  1. bufferedImagesEqual(final BufferedImage img1, final BufferedImage img2)
  2. equals(BufferedImage a, BufferedImage b)
  3. equals(BufferedImage img1, BufferedImage img2)
  4. equals(final BufferedImage image1, final BufferedImage image2)
  5. imagesAreEqual(String referenceImagePath, String capturedImagePath, int x, int y, int w, int h)
  6. imagesEqual(File file1, File file2)
  7. imgEquals(File imgRef, File img)