converting into an image file

Hi all, any one have idea on how to create an image file(*.PNG) from an applet. What i mean here is that currently i've an applet which there are many character and shape are being drawn on it, and now i need to create an image which will include all the graphics on that particular applet. I'm able to get the graphic from the applet, but to draw and put create it into an image file, i would need to use something like:

[code]// the g is a Graphicsg.drawImage(img, 0, 0, null);[/code]

Now, the problem is that i have no idea how to convert the "[b]img[/b]" into an "Image" component, anyone? Thanks a lot.