有扩展包JAI,自己找找
不然的话只好看GIF算法自己写了。

解决方案 »

  1.   

    我当时用了一个,是个J爱好者编的,你可以找Pure Java Awt包,该包包含这个写GIF的工具,传入awt.image和java.io.outputstream
      

  2.   

    很容易的
    import java.io.*;
    import java.awt.*;
    import javax.servlet.*;
    import javax.servlet.http.*;import Acme.JPM.Encoders.GifEncoder;public class HelloWorldGraphics extends HttpServlet {  public void doGet(HttpServletRequest req, HttpServletResponse res)
                                   throws ServletException, IOException {
        ServletOutputStream out = res.getOutputStream();  // binary output!    Frame frame = null;
        Graphics g = null;    try {
          // Create an unshown frame
          frame = new Frame();
          frame.addNotify();      // Get a graphics region, using the Frame
          Image image = frame.createImage(400, 60);
          g = image.getGraphics();      // Draw "Hello World!" to the off screen graphics context
          g.setFont(new Font("Serif", Font.ITALIC, 48));
          g.drawString("Hello World!", 10, 50);      // Encode the off screen image into a GIF and send it to the client
          res.setContentType("image/gif");
          GifEncoder encoder = new GifEncoder(image, out);
          encoder.encode();
        }
        finally {
          // Clean up resources
          if (g != null) g.dispose();
          if (frame != null) frame.removeNotify();
        }
      }
    }