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

huangapple 未分类评论49阅读模式
英文:

Grapchis 2D draw image changing color of Image

问题

我正在尝试将不同的图像附加到一张图像上。这一步已经完成,但在附加后,图像的颜色发生了变化。以下是我的现有代码:

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(baseImg, "jpeg", new File(path));

我能够在指定的坐标上将图像添加到基础图像上,但基础图像的颜色发生了变化。

这是一个示例图像:Grapchis 2D绘制图像更改图像颜色

提前感谢。

英文:

I am trying to attach different images into a image. This is happening but after attaching the color of the image changes. Here is my existing code

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));

i am able to add the image to the base image at the specified co-ordinates but the base image colour is getting changed.
Here is a sample imageGrapchis 2D绘制图像更改图像颜色

Thanks in advance

huangapple
  • 本文由 发表于 2020年5月4日 19:43:20
  • 转载请务必保留本文链接:https://java.coder-hub.com/61591450.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定