Modify Colors in a Picture
I started programming with Java few weeks ago, and I am working now with pictures and learning how to modify different elements in them.
I know how to increase/decrease RGB individually, and I recently managed to write a method that allows me to change the value of RGB by inputting a specific value:
value = pixel.getRed( ) ;
pixel.setRed ( ( int ) ( redAmount ¤ value ) ) ;
and modifying the values later on with
But now I was wondering.. what if I want to change my new red value to the previous green value and my new green value to the previous blue value and my new blue value to the previous red value of a specific pixel. what I mean is that if I had a pixel on a picture with value (200,180,190). How could I write my method in a way that I could simply make the value of red (200) turn into the original value of green (180), for all pixels in that picture?
Any help is appreciated :)