Classes for handling the creation of GIF image files.
Benjamin Norman's GIFUtils package that allows GIF files to be created from Java Images. The original package documentation is included below:
GIFImage
is capable of reading all extensions and images in a gif89a file, but
only the graphic control extension (used for transparency and time delay) is currently supported
for image creation. Multiple images are available (as in an animated .gif). The term 'primary image'
is taken to mean the first image in a file.
This package was originally built around GIFEncoder
, by Adam Doppelt, which was in
turn based on gifsave.c, by Sverre H. Huseby. None of the current incarnation bears much
resemblance to these works, however.
GIFImage is currently very alpha-ish, and you may have to do some hacking if you want to take advantage of advanced features like time delays and looping. But it's free, so don't gripe too hard:) If you find a bug with this software, please email Benjamin Norman - bnorman@kent.edu.
GIFInputStream gis = new GIFInputStream( new FileInputStream(myFileName) ); GIFImage gi = new GIFImage(gis); int[] rgbPixels = gi.getRGBPixels();
int[] rgbPixels = myPixelGenerationMethod(); // get pixels somehow GIFImage gi = new GIFImage(rgbPixels, imageWidth); GIFOutputStream gos = new GIFOutputStream( new FileOutputStream(args[0]) ); gi.write(gos);
GIFImage gi = new GIFImage(rgbPixels, imageWidth); gi.setTransparentColor(Color.grey);
GIFImage gi = new GIFImage(rgbPixels1, imageWidth); // first image (0) gi.addImage(rgbPixels2, imageWidth); // second image (1) gi.addImage(rgbPixels3, imageWidth); // third image (2) gi.setDelay(50); // delay in 100th sec - defaults to first image (0) gi.setDelay(1, 50); // second image gi.setDelay(2, 50); // third image gi.setIterationCount(0); // infinite loop gi.write(myOutputStream);