Mr.Chowdary
Mr.Chowdary

Reputation: 3407

Adding/override one image to another image at specific position?

I want to add an image to another image at specific position either it would be pixels or cm or (x,y). I have to do it by java programming using JAI(Java Advanced Imaging).
I googled to get sample code.
I got replacing ,adding at the end only.But not at specific position.
Any idea is appreciatable.
Laxman chowdary

Upvotes: 2

Views: 1912

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347204

BufferedImage sourceImage = ImageIO.read("myImage");
BufferedImage overlayImage = ImageIO.read("myOverlay");

Graphics2D g2Source = sourceImage.createGraphics();
g2Source.drawImage(overlayImage, x, y, null);

g2Source.dispose();

Upvotes: 2

Related Questions