Solved

Add transparent img on top of BufferedImage

Posted on 2004-10-03
3
199 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 50 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to parse custom JSON to POJO java 4 72
eclipse argument 14 60
netstat -ano | find "8000" and taskkill /f /pid 2984 3 55
Apps blocked by Java 9 79
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

808 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