Reputation: 31552
I'm processing a bunch of images with some framework, and all I'm given is a bunch of BufferedImage
objects. Unfortunately, these images are really dim, and I'd like to brighten them up and adjust the contrast a little.
Something like:
BufferedImage image = something.getImage();
image = new Brighten(image).brighten(0.3); // for 30%
image = new Contrast(image).contrast(0.3);
// ...
Any ideas?
Upvotes: 17
Views: 27735
Reputation: 31552
That was easy, actually.
RescaleOp rescaleOp = new RescaleOp(1.2f, 15, null);
rescaleOp.filter(image, image); // Source and destination are the same.
A scaleFactor
of 1.2 and offset
of 15 seems to make the image about a stop brighter.
Yay!
Read more in the docs for RescaleOp
.
Upvotes: 30