public class GifSequenceWriter extends Object
GifSequenceWriter
uses java ImageIO
to write animated gifs.
Taken wholesale from: http://elliot.kroo.net/software/java/GifSequenceWriter/
and modified to play nicely with openimajModifier and Type | Field and Description |
---|---|
protected ImageWriter |
gifWriter |
protected IIOMetadata |
imageMetaData |
protected ImageWriteParam |
imageWriteParam |
Constructor and Description |
---|
GifSequenceWriter(ImageOutputStream outputStream,
int timeBetweenFramesMS,
boolean loopContinuously)
Creates a new GifSequenceWriter.
|
GifSequenceWriter(ImageOutputStream outputStream,
int imageType,
int timeBetweenFramesMS,
boolean loopContinuously)
Creates a new GifSequenceWriter
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this GifSequenceWriter object.
|
static GifSequenceWriter |
createWriter(int timeBetweenFramesMS,
boolean loopContinuously,
File f)
Construct a
GifSequenceWriter which writes to a file |
static void |
writeGif(List<Image<?,?>> frames,
int timeBetweenFramesMS,
boolean loopContinuously,
File file)
Write an array of images to a gif file.
|
static void |
writeGif(List<Image<?,?>> frames,
int timeBetweenFramesMS,
boolean loopContinuously,
ImageOutputStream output)
Write some frames into an
ImageOutputStream |
static void |
writeGif(List<Image<?,?>> frames,
int timeBetweenFramesMS,
boolean loopContinuously,
OutputStream stream)
Write an array of images to a gif output stream
|
void |
writeToSequence(Image<?,?> img)
Write an image to the sequence
|
protected ImageWriter gifWriter
protected ImageWriteParam imageWriteParam
protected IIOMetadata imageMetaData
public GifSequenceWriter(ImageOutputStream outputStream, int imageType, int timeBetweenFramesMS, boolean loopContinuously) throws IIOException, IOException
outputStream
- the ImageOutputStream to be written toimageType
- one of the imageTypes specified in BufferedImagetimeBetweenFramesMS
- the time between frames in milisecondsloopContinuously
- wether the gif should loop repeatedlyIIOException
- if no gif ImageWriters are foundIOException
public GifSequenceWriter(ImageOutputStream outputStream, int timeBetweenFramesMS, boolean loopContinuously) throws IIOException, IOException
outputStream
- the ImageOutputStream to be written totimeBetweenFramesMS
- the time between frames in milisecondsloopContinuously
- whether the gif should loop repeatedlyIIOException
- if no gif ImageWriters are foundIOException
public void writeToSequence(Image<?,?> img) throws IOException
img
- IOException
public void close() throws IOException
IOException
public static void writeGif(List<Image<?,?>> frames, int timeBetweenFramesMS, boolean loopContinuously, File file) throws IOException
frames
- timeBetweenFramesMS
- loopContinuously
- file
- IOException
public static GifSequenceWriter createWriter(int timeBetweenFramesMS, boolean loopContinuously, File f) throws IIOException, FileNotFoundException, IOException
GifSequenceWriter
which writes to a filetimeBetweenFramesMS
- loopContinuously
- f
- GifSequenceWriter
instanceIOException
FileNotFoundException
IIOException
public static void writeGif(List<Image<?,?>> frames, int timeBetweenFramesMS, boolean loopContinuously, OutputStream stream) throws IOException
frames
- timeBetweenFramesMS
- loopContinuously
- stream
- IOException
public static void writeGif(List<Image<?,?>> frames, int timeBetweenFramesMS, boolean loopContinuously, ImageOutputStream output) throws IOException
ImageOutputStream
frames
- timeBetweenFramesMS
- loopContinuously
- output
- IOException