I am making a game, and I am wondering how to make an image from a graphics object. I have tiles stored in an xml file. I then read from this file to make the level, however I would like to have a thumbnail for each level. This is why I would like to convert. The Graphics portion takes up the whole screen, but the thumbnail would only take up a large amount. I can easily resize the image for this purpose. Hould would I be able to create this thumbnail from the graphics that I read from the file?

Thanks for the help

Recommended Answers

All 3 Replies

Created a BufferedImage of the desired dimensions, create a graphics context for it with createGraphics(), and pass that to your rendering method or paint() method.

Use the ImageIO.write() method to write that out to a file.

Thanks. I am still working on getting it to work, but the problem isn't with the image any more.

And so what is the current proble then :=)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.