File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating images

 
pradeep selvaraj
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How could i generate images in memory and save them into a image(any image format) file.

Thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic