Java Image Brighten brighten(BufferedImage bufferedImage, float amount)

Here you can find the source of brighten(BufferedImage bufferedImage, float amount)

Description

brighten

License

Open Source License

Declaration

public static BufferedImage brighten(BufferedImage bufferedImage, float amount) 

Method Source Code

//package com.java2s;
/**//from  w w w .j  ava2s. co m
 *                    
 * @author greg (at) myrobotlab.org
 *  
 * This file is part of MyRobotLab (http://myrobotlab.org).
 *
 * MyRobotLab is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version (subject to the "Classpath" exception
 * as provided in the LICENSE.txt file that accompanied this code).
 *
 * MyRobotLab is distributed in the hope that it will be useful or fun,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * All libraries in thirdParty bundle are subject to their own license
 * requirements - please refer to http://myrobotlab.org/libraries for 
 * details.
 * 
 * Enjoy !
 * 
 * */

import java.awt.image.BufferedImage;

import java.awt.image.RescaleOp;

public class Main {
    public static BufferedImage brighten(BufferedImage bufferedImage, float amount) {
        // brighten 30% = 1.3f darken by 10% = .9f
        RescaleOp op = new RescaleOp(amount, 0, null);
        bufferedImage = op.filter(bufferedImage, null);
        return bufferedImage;
    }
}

Related

  1. brighten(BufferedImage image)
  2. brighten(BufferedImage src, float offset)
  3. brightenImage(BufferedImage image, float brigtness, float offset)
  4. brightenImage(BufferedImage srcImg)