File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Game Development and the fly likes How to create image from bufferedImage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "How to create image from bufferedImage" Watch "How to create image from bufferedImage" New topic

How to create image from bufferedImage

Steven Decke

Joined: Dec 02, 2006
Posts: 5
Hi all.

I have been learning java for a short while and am enjoying makeing some games. Check on my site.

I have made to games in the form of applets. Basically the game plays on a big Gif image of about 200Kb. The scrolling image is about 4000 by 2000 high and is dragged within the applet. So its quite a big image to down load. What I would like to do is create the image in-game by composting the image from its constituent sprites. What I am trying to say is that can the buffered image be made into a Gif and saved? Is it possible to do that?

I would appreciate anyone taking the time to help me out.

pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
Java does not (yet) support writing gif images due to license problems.
There are free libraries available for this thoug: one of them is net.jmge.gif.Gif89Encoder

Check it out and see if it helps you.

I would suggest you have a look at the so called tile based games. Even if your game background is not repetitive like in a stadnard tile based game you can use the aproach to improve performance of your game:

The background image is split into several tiles (probably square shaped images of say 64*64 pixels (usualy a power of 2).
If your view is 200 * 200 pixels then you need to show 4 * 4 images at once. Well i guess you get the picture (no pun intended :-)). Check out for an idea how this could work.
You will probably find code that does this if you do not want to do it yourself...

I agree. Here's the link:
subject: How to create image from bufferedImage
It's not a secret anymore!