public final class GifDecoder
extends java.lang.Object
A decoder capable of processing a GIF data stream to render the graphics contained in it. This implementation follows the official GIF specification.
Example usage:
final GifImage gifImage = GifDecoder.read(int[] data); final int width = gifImage.getWidth(); final int height = gifImage.getHeight(); final int frameCount = gifImage.getFrameCount(); for (int i = 0; i < frameCount; i++) { final BufferedImage image = gifImage.getFrame(i); final int delay = gif.getDelay(i); }
Modifier and Type | Class and Description |
---|---|
class |
GifDecoder.GifImage |
Constructor and Description |
---|
GifDecoder() |
Modifier and Type | Method and Description |
---|---|
static GifDecoder.GifImage |
read(byte[] in) |
static GifDecoder.GifImage |
read(java.io.InputStream is) |
public static final GifDecoder.GifImage read(byte[] in) throws java.io.IOException
in
- Raw image data as a byte[] arrayjava.io.IOException
- If the image violates the GIF specification or is truncated.public static final GifDecoder.GifImage read(java.io.InputStream is) throws java.io.IOException
is
- Image data as input stream. This method will read from the
input stream's current position. It will not reset the
position before reading and won't reset or close the stream
afterwards. Call these methods before and after calling this
method as needed.java.io.IOException
- If an I/O error occurs, the image violates the GIF
specification or the GIF is truncated.