/** | |
* Compare two images. | |
* @param bitmap1 | |
* @param bitmap2 | |
* @return true iff both images have the same dimensions and pixel values. | |
*/ | |
public static boolean compareImages(Bitmap bitmap1, Bitmap bitmap2) { | |
if (bitmap1.getWidth() != bitmap2.getWidth() || | |
bitmap1.getHeight() != bitmap2.getHeight()) { | |
return false; | |
} | |
for (int y = 0; y < bitmap1.getHeight(); y++) { | |
for (int x = 0; x < bitmap1.getWidth(); x++) { | |
if (bitmap1.getPixel(x, y) != bitmap2.getPixel(x, y)) { | |
return false; | |
} | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment