Skip to content

Change Color of An Image In JAVA

Published
Reading time
1 min read
Views
1.3k views
How to Add ArrayList into Another ArrayList Java Code

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.

Comments are reviewed before they appear.

More like this

More in Programming

Programming

How To Read Data From .txt File Java

In this article you will learn Read Data From .txt File in Java Language Line by Line. This is very easy Step by Step program is written below. String str = null; try { B…

Programming

How to Add ArrayList into Another ArrayList Java Code

In this tutorial you will learn How to Add ArrayList into Another ArrayList Java Code. Very simple program for beginners. ArrayList<arraylist nteger="">> nodes = new Arra…

Programming

Draw sine function with PHP code on an image.

Now we learn how to draw a sine function in PHP. It is very simple and easy to draw sine function in PHP language. This function will generate a sine wave on image. Watch…