cs.ed.ac.uk/%7Emxr/gfx/">Graphics Interchange Format). A GIFEncoder is constructed with either an AWT Image (which must be fully loaded) or a set of RGB arrays. The image can be written out with a call to Write.
Three caveats:
GIFEncoder will convert the image to indexed color upon construction. This will take some time, depending on the size of the image. Also, actually writing the image out (Write) will take time.
The image cannot have more than 256 colors, since GIF is an 8 bit format. For a 24 bit to 8 bit quantization algorithm, see Graphics Gems II III.2 by Xialoin Wu. Or check out his C source.
Since the image must be completely loaded into memory, GIFEncoder may have problems with large images. Attempting to encode an image which will not fit into memory will probably result in the following exception:
java.awt.AWTException: Grabber returned false: 192
GIFEncoder is based upon gifsave.c, which was written and released by:
Sverre H. Huseby Bjoelsengt. 17 N-0468 Oslo Norway
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.