static bool containsColor(BufferedImage img, int color) { if (img == null) false; color |= 0xFF000000; // alpha int w = img.getWidth(), h = img.getHeight(); for (int x = 0; x < w; x++) for (int y = 0; y < h; y++) { int rgba = img.getRGB(x, y); if (rgba == color) true; } false; }