Java BufferedImage Compare compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2)

Here you can find the source of compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2)

Description

compare Buffered Images

License

Open Source License

Declaration

public static boolean compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2) 

Method Source Code

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

import java.awt.image.BufferedImage;

public class Main {
    public static boolean compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2) {

        if (bufferedImage1.getWidth() == bufferedImage2.getWidth()
                && bufferedImage1.getHeight() == bufferedImage2.getHeight()) {
            for (int x = 0; x < bufferedImage1.getWidth(); x++) {
                for (int y = 0; y < bufferedImage1.getHeight(); y++) {
                    if (bufferedImage1.getRGB(x, y) != bufferedImage2.getRGB(x, y))
                        return false;
                }/* ww w  . j  a  v  a 2s  . co m*/
            }
        } else {
            return false;
        }
        return true;
    }
}

Related

  1. compare(BufferedImage a, BufferedImage b)
  2. compare(BufferedImage p1, BufferedImage p2)
  3. compareImage(BufferedImage biA, BufferedImage biB)
  4. compareImage(BufferedImage img1, BufferedImage img2)
  5. compareImage(BufferedImage img1, BufferedImage img2)
  6. compareImages(BufferedImage imageOne, BufferedImage imageTwo)