how can I change image color using jcolorchooser like this
in java
Image 1

to
Image 2

File input = new File("dprocessing.jpg");
image = ImageIO.read(input);
width = image.getWidth();
height = image.getHeight();
for(int i=0; i<height; i++){
for(int j=0; j<width; j++){
Color c = new Color(image.getRGB(j, i));
int red = (int)(c.getRed() * 0.299);
int green = (int)(c.getGreen() * 0.587);
int blue = (int)(c.getBlue() *0.114);
Color newColor = new Color(red+green+blue,red+green+blue,red+green+blue);
image.setRGB(j,i,newColor.getRGB());
}
}
File ouptut = new File("new_Image.jpg");
ImageIO.write(image, "jpg", ouptut);
Any help will be appreciated...
You can solve this by changing it to this:
let me know if this works for you