• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

combining 2 buffered images

 
manoswa kapoor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created 1 buffered image in "Class A"..."Class B" calls this 'BufferedImage 1' and in "Class B" 'Buffered Image 2' is present....now i want to combine these two images to create one image....please note these images are not loaded these are created in applet using canvas and converted to image object.
 
Rob Spoor
Sheriff
Pie
Posts: 20494
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you want to combine them? Paste one over the other? Or below / next to each other?

If the latter, create yet another BufferedImage, use its Graphics2D object to paint the images on, dispose the Graphics2D object and you're done.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming both images have the same dimensions, you can blend them using the technique outlined in this article, particularly in the paragraph titled "A Better Technique for Blending Images". You only need to determine the weight factor (which would be 0.5 if both images should have the same weight).
 
manoswa kapoor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually i was new to this site so by mistake same question goes to many area....lets continue here

can you tell where to download jai api and hw to work on it??
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think JAI lives at jai.dev.java.net; you should be able to find sample code there as well.

You haven't said what you mean by "combine", though - depending on that, it may not be necessary to use JAI, as I said in my previous post.
 
manoswa kapoor
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here by combine i mean 1 image over another
and i am not getting how to use jai in netbeans
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you read the article I linked to? It explains how to overlay one image over another without the use of any libraries.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic