Java Utililty Methods BufferedImage Compare

List of utility methods to do BufferedImage Compare

Description

The list of methods to do BufferedImage Compare are organized into topic(s).

Method

booleancompareImgToFile(BufferedImage img, File file)
compare Img To File
if (file.exists()) {
    System.err.println("File " + file.getName() + " exists");
    BufferedImage fImg = null;
    try {
        fImg = ImageIO.read(file);
        System.err.println("Read image");
    } catch (IOException e) {
        System.err.println("Error reading image: " + e.getMessage());
...
intimageDifference(BufferedImage imgA, BufferedImage imgB)
image Difference
int dHeight = Math.abs(imgA.getHeight() - imgB.getHeight());
int dWidth = Math.abs(imgA.getWidth() - imgB.getWidth());
int diff = 3 * 255 * dHeight * dWidth;
for (int y = 0; y < Math.min(imgA.getHeight(), imgB.getHeight()); y++) {
    for (int x = 0; x < Math.min(imgA.getWidth(), imgB.getWidth()); x++) {
        final int colourA = imgA.getRGB(x, y);
        final int colourB = imgB.getRGB(x, y);
        diff += Math.abs((int) ((colourA & 0x00ff0000) >> 16) - (int) ((colourB & 0x00ff0000) >> 16));
...