import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class Image {
public void colorImage(int r,int g,int b,String rString,String gString,String bString){
int width=16;
int height=16;
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2d=(Graphics2D) bufferedImage.getGraphics();
graphics2d.setBackground(Color.WHITE);
graphics2d.clearRect(0, 0, width, height);
graphics2d.setPaint(new Color(r,g,b));
graphics2d.fillRect(0, 0, 100, 100);
String rgbString=rString+gString+bString;
String filePath="D:/workspace/LayerManagement/LayerManagement/WebContent/css/img/image"+rgbString+".png";
File file = new File(filePath);
try {
ImageIO.write(bufferedImage, "png", file);
} catch (IOException e) {
e.printStackTrace();
}
}
}