| Author |
Generating images
|
pradeep selvaraj
Ranch Hand
Joined: Nov 29, 2005
Posts: 62
|
|
How could i generate images in memory and save them into a image(any image format) file. Thanks
|
[<a href="http://cyvis.sourceforge.net" target="_blank" rel="nofollow">CyVis - Software Complexity Visualiser</a>] [<a href="http://pradeepselvaraj.blogspot.com" target="_blank" rel="nofollow">Pradeep's Blog</a>]
|
 |
Nathan Pruett
Bartender
Joined: Oct 18, 2000
Posts: 4121
|
|
The easiest way to do this is use the new ImageIO API - the last sample on this page shows how easy it is to read and write images in many formats using it. The only problem is that ImageIO does not support writing GIF files "out of the box" currently - however, there are plugins you can use to do so, and GIF encoding will be included in the next JDK release (since the GIF patent will have expired). The "in memory" part would be accomplished by using the BufferedImage class. You create one (or load one using ImageIO), call getGraphics() or createGraphics() on it to get the graphics context, and then just draw on it the same way you would draw on an AWT component in it's paint() method or a Swing component in it's paintComponent() method.
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
 |
|
|
subject: Generating images
|
|
|