6

I have an image imported in JLabel. Is there any built in function in Java that i can use to change brightness and contrast of that image with a Slider?

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
Rizwan606
  • 667
  • 2
  • 8
  • 22

1 Answers1

7

You may try RescaleOp class (pixel-by-pixel rescaling) methods.

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
  • 2
    You can attach a listener to the Slider and call the `filter` method of the RescaleOp class to increase or decrease the contrast of your image, based on the position of the slider. – phuibers Sep 05 '11 at 07:32
  • 3
    +1 for `RescaleOp`. There's a related example [here](http://stackoverflow.com/questions/5864490/how-to-setsize-of-image-using-rescaleop/5864503#5864503). – trashgod Sep 05 '11 at 11:06