Here you can find the source of makeImageTranslucent(BufferedImage source, float alpha)
public static BufferedImage makeImageTranslucent(BufferedImage source, float alpha)
//package com.java2s; //License from project: Apache License import java.awt.*; import java.awt.image.BufferedImage; public class Main { public static BufferedImage makeImageTranslucent(BufferedImage source, float alpha) { BufferedImage target = new BufferedImage(source.getWidth(), source.getHeight(), java.awt.Transparency.TRANSLUCENT); // Get the images graphics Graphics2D g = target.createGraphics(); // Set the Graphics composite to Alpha g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); // Draw the image into the prepared reciver image g.drawImage(source, null, 0, 0); // let go of all system resources in this Graphics g.dispose();//from w w w. ja va2s . c om // Return the image return target; } }