Java Color Brighten increaseBrightness(Image image)

Here you can find the source of increaseBrightness(Image image)

Description

Aumenta el brillo de una imagen.

License

Open Source License

Declaration

public static Image increaseBrightness(Image image) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;

import java.awt.Image;

import java.awt.image.BufferedImage;

public class Main {
    /**/*from w  ww  .j  a  v  a  2 s  . c  o m*/
     * Aumenta el brillo de una imagen.
     */
    public static Image increaseBrightness(Image image) {
        BufferedImage result = new BufferedImage(image.getWidth(null), image.getHeight(null),
                BufferedImage.TYPE_INT_ARGB);
        result.getGraphics().drawImage(image, 0, 0, null);

        for (int x = 0; x < image.getWidth(null); x++) {
            for (int y = 0; y < image.getHeight(null); y++) {
                Color c = new Color(result.getRGB(x, y));
                result.setRGB(x, y, new Color(verifyRange(c.getRed() + 100), verifyRange(c.getGreen() + 100),
                        verifyRange(c.getBlue() + 100)).getRGB());
            }
        }
        return result;

    }

    private static int verifyRange(double value) {
        if (value < 0) {
            return 0;
        } else if (value > 255) {
            return 255;
        } else {
            return (int) value;
        }
    }
}

Related

  1. getSlightlyBrighter(Color color)
  2. getSlightlyBrighter(Color color)
  3. hsbToRgB(double hue, double sat, double brightness)
  4. HSBtoRGB(float hue, float saturation, float brightness)
  5. HSBtoRGB(float parHue, float parSaturation, float parBrightness)
  6. makeColorBrighter(Color color)
  7. modifyBrightness(Color c, float brightness)
  8. perceivedBrightness(Color c)
  9. setBrightness(Color color, float brightness)