If you want to create GIFs, use ACME labs excellent free gifencoder(
and then do something like this:
Frame frame = null;
Graphics g = null;
FileOutputStream fileOut = null;
try
{
//create an unshown frame
frame = new Frame();
frame.addNotify();
//get a graphics region, using the frame
Image image = frame.createImage(WIDTH, HEIGHT);
g = image.getGraphics();
//manipulate the image
g.drawString("Hello world", 0, 0);
//get an ouputstream to a file
fileOut = new FileOutputStream("test.gif"

;
GifEncoder encoder = new GifEncoder(image, fileOut);
encoder.encode();
}
catch (Exception e)
{
;
}
finally
{
//clean up
if (g != null) g.dispose();
if (frame != null) frame.removeNotify();
if (fileOut != null) {
try { fileOut.close(); }
catch (IOException ioe) { ; }
}
}
I have used this code both in jsp & servlets & it works fine..
