White is in RGB 255,255,255, therefore:
Color myWhite = new Color(255, 255, 255); // Color white int rgb = myWhite.getRGB(); try { BufferedImage img = null; try { img = ImageIO.read(new File("bubbles.bmp")); } catch (IOException e) { } for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { img.setRGB(i, j, rgb); } } // retrieve image File outputfile = new File("saved.png"); ImageIO.write(img, "png", outputfile); } catch (IOException e) { }
Lo juego
source share