Reymmer Reymmer - 3 months ago 23
Java Question

Get a BufferedImage output composed of several image layers

for my current work, I need to add images on top of other images at runtime. I already searched and I don't want to draw it on a Swing component, I use it in an external API.
Ideally, I would like a library (or a java-native way) with which I can specify several images to "layer", and it would return me a BufferedImage (or any Image object by the way).

Answer

If you want a single image (BufferedImage) in return, then you need to compose your images.
This answer may help you stackoverflow.com/questions/2318020/merging-two-images. Have a look at the documentation for method drawImage to control position and scaling of any drawing through the Graphics object.

Comments