I dont know if Xith3D has a class specifically for this but you can do this via the java.awt.Robot and javax.imageio.ImageIO class.
Unfortunately ImageIO doesn't seem to save JPEGs with the highest quality. However, if you write PNGs (which I dont think is fully supported prior to 1.5) the image will be lossless.
For your information, this is actually possible.
This is the code I use in my photo album processing program
Gallery Mage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| public static void writeJpegImage(BufferedImage toWrite, String fileout, float quality) throws IOException { ImageOutputStream ios = ImageIO.createImageOutputStream(new File(fileout)); ImageWriter writer = null; Iterator iter = ImageIO.getImageWritersByFormatName("jpg"); if (iter.hasNext()) { writer = (ImageWriter)iter.next(); } writer.setOutput(ios); ImageWriteParam iwparam = writer.getDefaultWriteParam(); iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ; iwparam.setCompressionQuality(quality) ; writer.write(null, new IIOImage(toWrite, null, null), iwparam); ios.flush(); writer.dispose(); ios.close(); } |
You can also find that solution by looking up "ugly" in your dictionary

Cheers,
Will.