0
我想把兩個圖像放在一起使用java。所以,我想在它的工作另一種緩衝圖像的頂部繪製緩衝圖像,但它破壞了圖像的顏色最終圖像是有點綠色 這裏是我的代碼:在另一個上繪製緩衝圖像?
try
{
BufferedImage source = ImageIO.read(new File("marker.png"));
BufferedImage logo = ImageIO.read(new File("pic.png"));
Graphics2D g = (Graphics2D) source.getGraphics();
g.drawImage(logo, 20, 50, null);
File outputfile = new File("image.jpg");
ImageIO.write(source, "jpg", outputfile);
}
catch (Exception e)
{
e.printStackTrace();
}