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.