I found this on another posting on JavaRanch. The "com.sun.image.codec.jpeg" package came with my VisualCafe install. It runs pretty quickly.
Hope this helps. Also, I found the GIF exporter on
www.acme.com, and will try it today.
Thanks for your help!
----------------------------
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import com.sun.image.codec.jpeg.*;
public class Text2Image {
public static void main(
String args[]) {
Frame myFrame = null;
Graphics2D myGraphics = null;
try {
myFrame = new Frame();
myFrame.addNotify();
BufferedImage buffImage = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("d:\\waterfall.jpg"));
myGraphics = buffImage.createGraphics();
myGraphics.setFont(new Font("Serif", Font.ITALIC, 48));
myGraphics.setColor(Color.white);
myGraphics.fillRect( 2, 2, 396, 196);
myGraphics.setColor(Color.red);
myGraphics.fillRect( 10, 130, 380, 60);
myGraphics.setColor(Color.green);
myGraphics.fillRect( 10, 10, 380, 60);
myGraphics.setColor(Color.yellow);
myGraphics.fillRect( 10, 70, 380, 60);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
encoder.encode(buffImage);
System.out.println("gets here");
bos.flush();
System.out.println("flushed");
bos.close();
System.out.println("closed");
buffImage.flush();
} catch (Exception e) {
e.printStackTrace();
} finally {
System.out.println("final");
if (myGraphics != null) {
myGraphics.dispose();
System.out.println("dispose");
}
if (myFrame != null) {
myFrame.removeNotify();
System.out.println("remove notify");
}
}
System.out.println("done!");
} //end of main method
} //end of Text2Image class
------------------
Tom McComb