|
|||||||||
Home >> All >> [ external overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
external
Class GIFEncoder

java.lang.Objectexternal.GIFEncoder
- public class GIFEncoder
- extends java.lang.Object
GIFEncoder is a class which takes an image and saves it to a stream
using the GIF file format (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:
Bjoelsengt. 17
N-0468 Oslo
Norway
Phone: +47 2 230539
sverrehu@ifi.uio.no
- Version:
- 0.90 21 Apr 1996
Field Summary | |
(package private) byte[] |
colors_
|
(package private) short |
height_
|
(package private) ImageDescriptor |
id_
|
(package private) int |
numColors_
|
(package private) byte[] |
pixels_
|
(package private) ScreenDescriptor |
sd_
|
(package private) short |
width_
|
Constructor Summary | |
GIFEncoder(byte[][] r,
byte[][] g,
byte[][] b)
Construct a GIFEncoder. |
|
GIFEncoder(java.awt.Image image)
Construct a GIFEncoder. |
Method Summary | |
(package private) void |
ToIndexedColor(byte[][] r,
byte[][] g,
byte[][] b)
|
void |
Write(java.io.OutputStream output)
Writes the image out to a stream in the GIF file format. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
width_
short width_
height_
short height_
numColors_
int numColors_
pixels_
byte[] pixels_
colors_
byte[] colors_
sd_
ScreenDescriptor sd_
id_
ImageDescriptor id_
Constructor Detail |
GIFEncoder
public GIFEncoder(java.awt.Image image) throws java.awt.AWTException
- Construct a GIFEncoder. The constructor will convert the image to
an indexed color array. This may take some time.
GIFEncoder
public GIFEncoder(byte[][] r, byte[][] g, byte[][] b) throws java.awt.AWTException
- Construct a GIFEncoder. The constructor will convert the image to
an indexed color array. This may take some time.
Each array stores intensity values for the image. In other words, r[x][y] refers to the red intensity of the pixel at column x, row y.
Method Detail |
Write
public void Write(java.io.OutputStream output) throws java.io.IOException
- Writes the image out to a stream in the GIF file format. This will
be a single GIF87a image, non-interlaced, with no background color.
This may take some time.
ToIndexedColor
void ToIndexedColor(byte[][] r, byte[][] g, byte[][] b) throws java.awt.AWTException
|
|||||||||
Home >> All >> [ external overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |