英文:
How can I superimpose two pictures together in 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:
Then I want to superimpose this image on top of it:
To get this:
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并找到相应的命令。
专注分享java语言的经验与见解,让所有开发者获益!
评论