Here you can find the source of compare(BufferedImage a, BufferedImage b)
Parameter | Description |
---|---|
a | The image to compare against |
b | The image to compare with |
public static boolean compare(BufferedImage a, BufferedImage b)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { /**/* w ww . jav a 2 s.co m*/ * Method used to compare two given images * @param a The image to compare against * @param b The image to compare with * @return Weather or not the two images are the same */ public static boolean compare(BufferedImage a, BufferedImage b) { int aData = 0, bData = 0; for (int xPos = 0; xPos < a.getWidth(); xPos++) { for (int yPos = 0; yPos < a.getHeight(); yPos++) { aData = a.getRGB(xPos, yPos); } } for (int xPos = 0; xPos < b.getWidth(); xPos++) { for (int yPos = 0; yPos < b.getHeight(); yPos++) { bData = b.getRGB(xPos, yPos); } } return aData == bData; } }