3 Replies - 633 Views - Last Post: 04 April 2012 - 04:50 AM Rate Topic: -----

#1 ashishdonvir  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 02-April 12

use Jslider to increase/decrease brightness of an image

Posted 03 April 2012 - 07:39 AM

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.
Is This A Good Question/Topic? 0
  • +

Replies To: use Jslider to increase/decrease brightness of an image

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1057
  • View blog
  • Posts: 2,260
  • Joined: 30-January 11

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

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.
Was This Post Helpful? 0
  • +
  • -

#3 ashishdonvir  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 02-April 12

Re: use Jslider to increase/decrease brightness of an image

Posted 04 April 2012 - 01:26 AM

View PostRyano121, 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

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
Was This Post Helpful? 0
  • +
  • -

#4 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1057
  • View blog
  • Posts: 2,260
  • Joined: 30-January 11

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.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1