Java Utililty Methods BufferedImage Color Set

List of utility methods to do BufferedImage Color Set

Description

The list of methods to do BufferedImage Color Set are organized into topic(s).

Method

BufferedImagechangeBrightness(BufferedImage image, int offset)
Muda o brilho da imagem de acordo com o offset
float factor = 1.4f;
RescaleOp op = new RescaleOp(factor, offset, null);
BufferedImage brighter = op.filter(image, null);
return brighter;
BufferedImagechangeColor(BufferedImage image, Color color, Color replacement_color)
change Color
BufferedImage dimg = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = dimg.createGraphics();
g.setComposite(AlphaComposite.Src);
g.drawImage(image, null, 0, 0);
g.dispose();
for (int i = 0; i < dimg.getHeight(); i++) {
    for (int j = 0; j < dimg.getWidth(); j++) {
        if (dimg.getRGB(j, i) == color.getRGB()) {
...
BufferedImagechangeColor(BufferedImage image, Color replacement)
Changes color of image's border to specified color.
if (replacement == null) {
    return changeColor(image, COLOR_TO_REPLACE, TRANSPARENT_COLOR);
} else {
    return changeColor(image, COLOR_TO_REPLACE, replacement);
BufferedImagechangeColor(BufferedImage image, String hexval)
Changes the foreground colors to the color equivalent to the given hex value
int red = Integer.valueOf(hexval.substring(0, 2), 16);
int green = Integer.valueOf(hexval.substring(2, 4), 16);
int blue = Integer.valueOf(hexval.substring(4, 6), 16);
int RGBval = red;
RGBval = (RGBval << 8) + green;
RGBval = (RGBval << 8) + blue;
RGBval = RGBval + Color.BLACK.getRGB();
for (int w = 0; w < image.getWidth(); w++) {
...
voidchangeRGBSaturation(final BufferedImage image, final double s)
Changes the color saturation of the given RGB image.
double RW = 0.3086;
double RG = 0.6084;
double RB = 0.0820;
final double a = (1 - s) * RW + s;
final double b = (1 - s) * RW;
final double c = (1 - s) * RW;
final double d = (1 - s) * RG;
final double e = (1 - s) * RG + s;
...
BufferedImagechangeToTypeIntRGB(BufferedImage image)
change To Type Int RGB
BufferedImage output = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB);
for (int y = 0; y < image.getHeight(); y++)
    for (int x = 0; x < image.getWidth(); x++)
        output.setRGB(x, y, image.getRGB(x, y));
return output;
BufferedImagechangeTranslucentImage(BufferedImage img, float transperancy)
Change a image with a certain transparency.
bimg = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TRANSLUCENT);
g2 = bimg.createGraphics();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, transperancy));
g2.drawImage(img, null, 0, 0);
g2.dispose();
return bimg;