Java BufferedImage Compare compareImages(BufferedImage imgA, BufferedImage imgB)

Here you can find the source of compareImages(BufferedImage imgA, BufferedImage imgB)

Description

compare Images

License

Open Source License

Declaration

public static boolean compareImages(BufferedImage imgA, BufferedImage imgB) 

Method Source Code

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

import java.awt.image.BufferedImage;

public class Main {
    public static boolean compareImages(BufferedImage imgA, BufferedImage imgB) {
        if (imgA.getWidth() == imgB.getWidth() && imgA.getHeight() == imgB.getHeight()) {
            int width = imgA.getWidth();
            int height = imgA.getHeight();
            for (int y = 0; y < height; y++) {
                for (int x = 0; x < width; x++) {
                    if (imgA.getRGB(x, y) != imgB.getRGB(x, y)) {
                        return false;
                    }//  ww w.  j a v  a  2 s .c  o  m
                }
            }
        } else {
            return false;
        }
        return true;
    }
}

Related

  1. compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2)
  2. compareImage(BufferedImage biA, BufferedImage biB)
  3. compareImage(BufferedImage img1, BufferedImage img2)
  4. compareImage(BufferedImage img1, BufferedImage img2)
  5. compareImages(BufferedImage imageOne, BufferedImage imageTwo)
  6. compareImages(final BufferedImage firstImage, final BufferedImage secondImage)
  7. compareImages(final BufferedImage img1, final BufferedImage img2)
  8. compareImgToFile(BufferedImage img, File file)
  9. imageDifference(BufferedImage imgA, BufferedImage imgB)