int imgHeight = 300;
File file = new File("/home/ice/图片/test.png");
BufferedImage image = new BufferedImage(imgWidth, imgHeight,
BufferedImage.TYPE_INT_ARGB);//RGB形式
BackgroundFactory bf = new SimpleBackgroundFactory(new Color(255, 255, 0, 100));
bf.fillBackground(image);
try {
ImageIO.write(image, "png", file);
} catch (IOException e) {
e.printStackTrace();
}