I am using the ACME Gif Encoder to encode a Image object...

The code within a doPost method is as follows :
----------------------------------------------------
Frame frame = null;
Graphics g = null;
try{
frame = new Frame();
frame.addNotify();
Image image = frame.createImage(xmax,ymax);
g = image.getGraphics();
g.fillRect(30,30,xmax-30,ymax-50);
res.setContentType("image/gif");
GifEncoder encoder = new GifEncoder(image,out);
encoder.encode();
}
finally
{
if(g != null) g.dispose();
if(frame != null) frame.removeNotify();
}
-----------------------------------------------------

Now the problem is that the image that is visible on the browser is
a BMP and not a GIF file !
What could be wrong ???

Thanks,
Vikram