public class GIFReader extends ImageReader
Modifier and Type | Field and Description |
---|---|
protected int |
colorsUsed |
protected int |
delay |
protected int |
disposalMethod |
protected int |
image_x |
protected int |
image_y |
protected int |
logicalScreenHeight |
protected int |
logicalScreenWidth |
protected int |
transparencyFlag |
protected int |
transparent_color |
protected int |
userInputFlag |
bitsPerPixel, bytesPerScanLine, height, param, rgbColorPalette, width
Constructor and Description |
---|
GIFReader() |
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getBackgroundColor() |
java.awt.image.BufferedImage |
getFrame(int i) |
protected java.awt.image.BufferedImage |
getFrameAsBufferedImage(java.io.InputStream is)
Gets the current frame as a BufferedImage.
|
protected java.awt.image.BufferedImage |
getFrameAsBufferedImageEx(java.io.InputStream is)
Gets the current frame as a BufferedImage the same size as the logical screen.
|
int |
getFrameCount()
Get the total number of frames read by this GIFReader.
|
java.util.List<java.awt.image.BufferedImage> |
getFrames()
Get the total frames read by this GIFRreader.
|
GIFFrame |
getGIFFrame(int i) |
java.util.List<GIFFrame> |
getGIFFrames() |
int |
getLogicalScreenHeight() |
int |
getLogicalScreenWidth() |
int |
getTransparentColor() |
boolean |
isTransparent() |
java.awt.image.BufferedImage |
read(java.io.InputStream is) |
getImageParam
protected int logicalScreenWidth
protected int logicalScreenHeight
protected int disposalMethod
protected int userInputFlag
protected int transparencyFlag
protected int transparent_color
protected int delay
protected int colorsUsed
protected int image_x
protected int image_y
public java.awt.Color getBackgroundColor()
protected java.awt.image.BufferedImage getFrameAsBufferedImage(java.io.InputStream is) throws java.lang.Exception
Note: do not mix this method with read
or getFrameAsBufferedImageEx
.
Use them separately.
One way to use this method to retrieve all the frames from an animated GIF:
GIFReader reader = new GIFReader();
InputStream is = new FileInputStream(new File(pathToImage));
List<BufferedImage> frames = new ArrayList<BufferedImage>();
BufferedImage bi = null;
while((bi = reader.getFrameAsBufferedImage(is) != null)
frames.add(bi);
is
- InputStream for the GIF/Animated GIFjava.lang.Exception
protected java.awt.image.BufferedImage getFrameAsBufferedImageEx(java.io.InputStream is) throws java.lang.Exception
getFrameAsBufferedImage
which could be of different sizes and may also have to rely on the previous frames
to look the same as the frames created here.
Note: do not mix this method with read
or getFrameAsBufferedImage
.
Use them separately.
is
- input stream for the image - single frame or multiple frame animated GIFjava.lang.Exception
public int getFrameCount()
getFrameCount
in class ImageReader
public java.awt.image.BufferedImage getFrame(int i)
getFrame
in class ImageReader
public java.util.List<java.awt.image.BufferedImage> getFrames()
getFrames
in class ImageReader
public GIFFrame getGIFFrame(int i)
public java.util.List<GIFFrame> getGIFFrames()
public int getLogicalScreenHeight()
public int getLogicalScreenWidth()
public int getTransparentColor()
public boolean isTransparent()
public java.awt.image.BufferedImage read(java.io.InputStream is) throws java.lang.Exception
read
in class ImageReader
java.lang.Exception