I Had load my image Buffered image now need to brighten it using Slider or scroll-bar so could any one suggest me how to do it? If it can done using any ImageJ library then suggest me that also.
3 Replies - 633 Views - Last Post: 04 April 2012 - 04:50 AM
#1
use Jslider to increase/decrease brightness of an image
Posted 03 April 2012 - 07:39 AM
Replies To: use Jslider to increase/decrease brightness of an image
#2
Re: use Jslider to increase/decrease brightness of an image
Posted 03 April 2012 - 08:24 AM
You can get an integer color value for each pixel of the BufferedImage using the .getRGB method, and you can use the .setRGB to set the color of a particular pixel in the image
You can then make a Color object out of this returned integer (from the .getPixel) method using
Once you have this Color, you can use the .brighter method to make each pixel brighter.
Once you have the brighter Color, you then do the opposite. Get the RGB integer from the Color and use the setPixel method.
If you do this for each pixel in your image you will make it brighter. You can then attatch this to a JSlider or whatever.
You can then make a Color object out of this returned integer (from the .getPixel) method using
Color c = new Color(returnedValue);
Once you have this Color, you can use the .brighter method to make each pixel brighter.
Once you have the brighter Color, you then do the opposite. Get the RGB integer from the Color and use the setPixel method.
If you do this for each pixel in your image you will make it brighter. You can then attatch this to a JSlider or whatever.
#3
Re: use Jslider to increase/decrease brightness of an image
Posted 04 April 2012 - 01:26 AM
Ryano121, on 03 April 2012 - 08:24 AM, said:
You can get an integer color value for each pixel of the BufferedImage using the .getRGB method, and you can use the .setRGB to set the color of a particular pixel in the image
You can then make a Color object out of this returned integer (from the .getPixel) method using
Once you have this Color, you can use the .brighter method to make each pixel brighter.
Once you have the brighter Color, you then do the opposite. Get the RGB integer from the Color and use the setPixel method.
If you do this for each pixel in your image you will make it brighter. You can then attatch this to a JSlider or whatever.
You can then make a Color object out of this returned integer (from the .getPixel) method using
Color c = new Color(returnedValue);
Once you have this Color, you can use the .brighter method to make each pixel brighter.
Once you have the brighter Color, you then do the opposite. Get the RGB integer from the Color and use the setPixel method.
If you do this for each pixel in your image you will make it brighter. You can then attatch this to a JSlider or whatever.
OK. But please tell me that how could i attached it with JSlider
And Ya I will click on plus Button don't worry of that but please help me to use JSlider
#4
Re: use Jslider to increase/decrease brightness of an image
Posted 04 April 2012 - 04:50 AM
Well what have you tried?
Have a look at the documentation/tutorials on how to use the JSlider component.
How to use JSliders
Then you will see that you can handle the stateChanged event of the JSlider.
If the value has gone up then make it brighter via the way before, or if the value goes down, make the image darker via the .darker() method in the Color class.
Have a look at the documentation/tutorials on how to use the JSlider component.
How to use JSliders
Then you will see that you can handle the stateChanged event of the JSlider.
If the value has gone up then make it brighter via the way before, or if the value goes down, make the image darker via the .darker() method in the Color class.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|