List of utility methods to do BufferedImage Equal
boolean | bufferedImagesEqual(final BufferedImage img1, final BufferedImage img2) buffered Images Equal if (img1.getWidth() != img2.getWidth() || img1.getHeight() != img2.getHeight()) { return false; for (int x = 0; x < img1.getWidth(); x++) { for (int y = 0; y < img1.getHeight(); y++) { if (img1.getRGB(x, y) != img2.getRGB(x, y)) { return false; return true; |
boolean | equals(BufferedImage a, BufferedImage b) equals 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++) { ... |
boolean | equals(BufferedImage img1, BufferedImage img2) Returns true if the 2 images are equal, false otherwise if (img1.getWidth() != img2.getWidth()) { return false; if (img1.getHeight() != img2.getHeight()) { return false; System.err.println("Equal size"); int[] data1 = img1.getRGB(0, 0, img1.getWidth(), img1.getHeight(), null, 0, img2.getWidth()); ... |
boolean | equals(final BufferedImage image1, final BufferedImage image2) equals final int width1 = image1.getWidth(); final int width2 = image2.getWidth(); if (width1 != width2) { return false; final int height1 = image1.getHeight(); final int height2 = image2.getHeight(); if (height1 != height2) { ... |
boolean | imagesAreEqual(BufferedImage image1, BufferedImage image2) images Are Equal if (image1.getWidth() != image2.getWidth() || image1.getHeight() != image2.getHeight()) { return false; for (int x = 1; x < image2.getWidth(); x++) { for (int y = 1; y < image2.getHeight(); y++) { if (image1.getRGB(x, y) != image2.getRGB(x, y)) { return false; return true; |
boolean | imagesAreEqual(String referenceImagePath, String capturedImagePath, int x, int y, int w, int h) images Are Equal BufferedImage referenceImage = null; BufferedImage capturedImage; try { referenceImage = ImageIO .read(Thread.currentThread().getContextClassLoader().getResourceAsStream(referenceImagePath)); capturedImage = ImageIO.read(new File(capturedImagePath)); } catch (IOException e) { e.printStackTrace(); ... |
boolean | imagesEqual(File file1, File file2) images Equal BufferedImage image1 = ImageIO.read(file1); BufferedImage image2 = ImageIO.read(file2); int columns = image1.getWidth(); int rows = image1.getHeight(); for (int row = 0; row < rows; ++row) { for (int col = 0; col < columns; ++col) { int rgb1 = image1.getRGB(col, row); int rgb2 = image2.getRGB(col, row); ... |
boolean | imgEquals(File imgRef, File img) img Equals if (isCached(imgRef, img)) { return getComparisons(imgRef).get(img).booleanValue(); } else if (isCached(img, imgRef)) { return getComparisons(img).get(imgRef).booleanValue(); } else { BufferedImage refBI = ImageIO.read(imgRef); BufferedImage imgBi = ImageIO.read(img); int width = imgBi.getWidth(); ... |