Grapchis 2D绘制更改图像颜色的图像

时间:2020-05-04 11:43:20

标签: java bufferedimage graphics2d

我正在尝试将其他图像附加到图像中。发生这种情况,但是在附加了图像的颜色后,颜色发生了变化。这是我现有的代码

BufferedImage baseImg = getBaseImage(src);
Graphics2D g = baseImg.createGraphics();
BufferedImage bmg = getBufferedImageFromSrc(path);

String[] coords = coord.split(",");
g.drawImage((Image)bmg,(int) Double.parseDouble(coords[0]),(int) Double.parseDouble(coords[1]), 60,60,Color.white,null);
g.dispose();

 String path = "C://resources/temp.jpeg";  
 ImageIO.write(bimg, "jpeg", new File(path));

我可以在指定的坐标下将图像添加到基本图像,但是基本图像的颜色正在更改。 这是示例图片enter image description here

预先感谢

0 个答案:

没有答案
相关问题