1

I was wondering what the fastest way to alter the brightness of an image. I have implemented the 'RescaleOp' method but I don't know if this is the fastest method or there are others. Here is my implementation where I input an Image, change the brightness, and return an Image:

public static Image setBrightness(Image i) {
    BufferedImage buff = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB);
    buff.createGraphics().drawImage(i, 0, 0, null);
    RescaleOp op = new RescaleOp(brightness, offsets, null);
    BufferedImage buff1 = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB);
    buff1.createGraphics().drawImage(buff, op, 0, 0);
    return Toolkit.getDefaultToolkit().createImage(buff1.getSource());
}

PS: I also need to convert the BufferedImage back into an Image because my computer doesn't like rendering BufferedImages.

4

1 回答 1

2

Everything I've read leads me to believe that RescaleOp is the best, fastest option

于 2012-04-15T13:38:33.330 回答