用Java调整BufferedImage的亮度和对比度

a p*_*erd 13 java graphics image-processing

我正在使用一些框架处理一堆图像,而我给出的只是一堆BufferedImage对象.不幸的是,这些图像非常暗淡,我想让它们变亮并稍微调整对比度.

就像是:

BufferedImage image = something.getImage();
image = new Brighten(image).brighten(0.3); // for 30%
image = new Contrast(image).contrast(0.3);
// ...
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

a p*_*erd 25

实际上这很容易.

RescaleOp rescaleOp = new RescaleOp(1.2f, 15, null);
rescaleOp.filter(image, image);  // Source and destination are the same.
Run Code Online (Sandbox Code Playgroud)

scaleFactor1.2和offset15的A 似乎使关于停止的图像更亮.

好极了!

阅读更多文档RescaleOp.

  • @ADTC http://www.photographymad.com/pages/view/what-is-a-stop-of-exposure-in-photography (3认同)