Java Image Brighten brightenImage(BufferedImage srcImg)

Here you can find the source of brightenImage(BufferedImage srcImg)

Description

brighten Image

License

Apache License

Declaration

public static BufferedImage brightenImage(BufferedImage srcImg) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.image.BufferedImage;

import java.awt.image.LookupOp;
import java.awt.image.LookupTable;

import java.awt.image.ShortLookupTable;

public class Main {
    public static BufferedImage brightenImage(BufferedImage srcImg) {
        short brighten[] = new short[256];
        for (int i = 0; i < 256; i++) {
            short pixelValue = (short) (i + 10);
            if (pixelValue > 255)
                pixelValue = 255;//  w w  w .j ava 2s. co  m
            else if (pixelValue < 0)
                pixelValue = 0;
            brighten[i] = pixelValue;
        }
        LookupTable lookupTable = new ShortLookupTable(0, brighten);
        return applyFilter(lookupTable, srcImg);
    }

    public static BufferedImage applyFilter(LookupTable lookupTable, BufferedImage srcImg) {
        LookupOp lop = new LookupOp(lookupTable, null);
        return lop.filter(srcImg, null);
    }
}

Related

  1. brighten(BufferedImage bufferedImage, float amount)
  2. brighten(BufferedImage image)
  3. brighten(BufferedImage src, float offset)
  4. brightenImage(BufferedImage image, float brigtness, float offset)
  5. brightenOp(float mult, int add)