In this article we will learn how to Change Color of An Image In JAVA language. This is too much easy tutorial for beginners.
BufferedImage img = new BufferedImage(600, 315, BufferedImage.TYPE_INT_RGB );
for ( int rc = 0; rc < 315; rc++ )
{
for ( int cc = 0; cc < 600; cc++ )
{
img.setRGB(cc, rc, Color.BLACK.getRGB() ); //put color on image
}
}
String path = System.getProperty("user.home");
ImageIO.write(img, "PNG", new File(path+"\\Documents\\NetBeansProjects\\img.png"));
Questions & comments
Did this work for you, or did you hit a different error? Ask below and we will help.