Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add transparent img on top of BufferedImage

Posted on 2004-10-03
3
Medium Priority
?
206 Views
Last Modified: 2008-03-17
Hi all,
I have a .GIF image, with transparent areas on it. I also have a BufferedImage.
I would like to import and add the .GIF image on top of the BufferedImage some how.. :o\
Making sure that the transparent cells on the .GIF are also transparent after placed on top of the BufferedImage..

Can this be done?? Any examples would be MUCH appreciated! :D

Thanks in advance!
0
Comment
Question by:rubberdi
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 12211060
Get the Graphics of the buffered image and draw the gif over it

Graphics g = bi.getGraphics();
g.drawImage(yourGif......................................
0
 
LVL 9

Expert Comment

by:DrWarezz
ID: 12249422
Hi CEHJ -- sorry about the delay.

So, your above code will draw only the 'opaque' cells ontop of the BI?

Also, how do I then turn the 'Graphics g' to an image?
Would something like this work:  Image ii = new Image( g );  // ?????

(Soz for my ignorance)

Thanks alot, :)
[r.D]
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12250845
>>So, your above code will draw only the 'opaque' cells ontop of the BI?

Should do, if you've got a gif with transparency

>>Also, how do I then turn the 'Graphics g' to an image?

What do you want to do - produce a file, or what?

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question