Re: Creating a gif file from a visad display

  • To: Amaral <amaral@xxxxxx>
  • Subject: Re: Creating a gif file from a visad display
  • From: Tom Whittaker <tomw@xxxxxxxxxxxxx>
  • Date: Tue, 18 Mar 2003 08:24:22 -0600
As a footnote: Since Unisys holds a patent on the LZW encoding used in GIF images, if you are developing this software for commercial purposes, you would be required to secure a license from them in order to use GIF images (see: http://lpf.ai.mit.edu/Patents/Gif/unisys.html). At least they are no longer going after _everyone_ who generates GIF images...but it's still another reason to use PNG.

tom

Amaral wrote:
Please, I need help on the following problem. I would like to create a gif file from a visad display. I am using the code below but it does not work. Thanks for any help. Runnable captureImage = new Runnable() {
 public void run() {
 Image img = display.getImage();
 Graphics g =img.getGraphics();
g.drawImage(img, 0,0, null); try
  {
File filee = new File("file.gif");
OutputStream output = new BufferedOutputStream(new FileOutputStream(filee));
GIFEncoder encoder = new GIFEncoder(img);
encoder.Write(output);
  }
  catch (Exception w){ }
      }
    }
Thread t = new Thread(captureImage);
   t.start();

--
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Phone/VoiceMail: 608.262.2759