Solved

Add transparent img on top of BufferedImage

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now