Java BufferedImage Equal equals(BufferedImage a, BufferedImage b)

Here you can find the source of equals(BufferedImage a, BufferedImage b)

Description

equals

License

Open Source License

Declaration

public static boolean equals(BufferedImage a, BufferedImage b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.image.BufferedImage;

public class Main {
    public static boolean equals(BufferedImage a, BufferedImage b) {
        int aw = a.getWidth();
        int ah = a.getHeight();
        int bw = b.getWidth();
        int bh = b.getHeight();
        if ((aw != bw) || (ah != bh))
            return false;
        for (int y = 0; y < ah; y++)
            for (int x = 0; x < bw; x++) {
                if (a.getRGB(x, y) != b.getRGB(x, y)) {
                    return false;
                }//  w  w  w .  java  2 s .c om
            }
        return true;
    }
}

Related

  1. bufferedImagesEqual(final BufferedImage img1, final BufferedImage img2)
  2. equals(BufferedImage img1, BufferedImage img2)
  3. equals(final BufferedImage image1, final BufferedImage image2)
  4. imagesAreEqual(BufferedImage image1, BufferedImage image2)
  5. imagesAreEqual(String referenceImagePath, String capturedImagePath, int x, int y, int w, int h)