创建第二个
BufferedImage类型
TYPE_INT_RGB…
BufferedImage copy = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
将原件涂到副本上…
Graphics2D g2d = copy.createGraphics();g2d.setColor(Color.WHITE); // Or what ever fill color you want...g2d.fillRect(0, 0, copy.getWidth(), copy.getHeight());g2d.drawImage(img, 0, 0, null);g2d.dispose();
您现在有了图像的非透明版本…
要保存图像,请看写/保存图像



