如何在Java中将两张图片叠加在一起?

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

How can I superimpose two pictures together in Java?

问题

我试图将两个缓冲图像叠加在一起。

例如,我想以这个图像为基础:

如何在Java中将两张图片叠加在一起?

然后我想将这个图像叠加在其上:

如何在Java中将两张图片叠加在一起?

以获得这个效果:

如何在Java中将两张图片叠加在一起?

这可行吗?

英文:

I'm trying to take two buffered images and superimpose one over the other.

For example, I want to start with this image as a base:

如何在Java中将两张图片叠加在一起?

Then I want to superimpose this image on top of it:

如何在Java中将两张图片叠加在一起?

To get this:

如何在Java中将两张图片叠加在一起?

Is this possible?

答案1

得分: 0

在Java中进行图像操作,Im4java可能是一个不错的选择,它是与ImageMagick命令行交互的纯Java接口。这个链接可能是你寻找的类似内容。

英文:

For image manipulation in Java Im4java might be a good choice, its a pure-java interface to the ImageMagick command-line. This might be something similar what you are looking for.

答案2

得分: 0

你可以使用ImageIO来实现。如果你想自己实现,那么你可以迭代两幅图像的像素,调用你喜欢的函数来计算输出像素,然后将其放入目标图像中

英文:

You can do it with ImageIO. If you want to implement it on your own, then you can iterate the pixels of both images, call a function that you prefer to calculate the output pixel and put it into the target image.

答案3

得分: 0

以下是翻译好的内容:

您可以在Imagemagick命令行中完成这个操作。

这只是第二张图像的反转,然后是两张图像的50-50混合。

convert 1.png \( 2.png -negate \) -define compose:args=50 -compose blend -composite 1_2.png

对于Java,您可以使用im4java并找到相应的命令。

英文:

You can do that in Imagemagick command line.

It is just an invert of the second image and then a 50-50 blend of the two image.

convert 1.png \( 2.png -negate \) -define compose:args=50 -compose blend -composite 1_2.png

<br>
如何在Java中将两张图片叠加在一起?

For Java, you can use im4java and find the equivalent commands.

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

发表评论

匿名网友

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

确定