Class GifSequenceWriter


  • public class GifSequenceWriter
    extends Object
    This class will generate an animated GIF from a sequence of individual images. Embedded in Wayang to facilitate capturing animations and interfaces rendered on the Push, for producing great online documentation. Originally created by Elliot Kroo on 2009-04-25. See http://elliot.kroo.net/software/java/GifSequenceWriter/ James Elliott split the constructor into a variety of different versions, to accommodate the needs of Wayang. This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
    Author:
    Elliot Kroo (elliot[at]kroo[dot]net)
    • Constructor Detail

      • GifSequenceWriter

        public GifSequenceWriter​(ImageOutputStream outputStream,
                                 RenderedImage image,
                                 int timeBetweenFramesMS,
                                 boolean loopContinuously)
                          throws IIOException,
                                 IOException
        Creates a new GifSequenceWriter from an existing buffered image.
        Parameters:
        outputStream - the ImageOutputStream to be written to
        image - the source image that will be written to the output
        timeBetweenFramesMS - the time between frames in miliseconds
        loopContinuously - wether the gif should loop repeatedly
        Throws:
        IIOException - if no gif ImageWriters are found
        IOException
      • GifSequenceWriter

        public GifSequenceWriter​(ImageOutputStream outputStream,
                                 int imageType,
                                 int timeBetweenFramesMS,
                                 boolean loopContinuously)
                          throws IIOException,
                                 IOException
        Creates a new GifSequenceWriter
        Parameters:
        outputStream - the ImageOutputStream to be written to
        imageType - one of the imageTypes specified in BufferedImage
        timeBetweenFramesMS - the time between frames in miliseconds
        loopContinuously - wether the gif should loop repeatedly
        Throws:
        IIOException - if no gif ImageWriters are found
        IOException
      • GifSequenceWriter

        public GifSequenceWriter​(ImageOutputStream outputStream,
                                 ImageTypeSpecifier imageTypeSpecifier,
                                 int timeBetweenFramesMS,
                                 boolean loopContinuously)
                          throws IIOException,
                                 IOException
        Creates a new GifSequenceWriter
        Parameters:
        outputStream - the ImageOutputStream to be written to
        imageTypeSpecifier - the type of images to be written
        timeBetweenFramesMS - the time between frames in miliseconds
        loopContinuously - wether the gif should loop repeatedly
        Throws:
        IIOException - if no gif ImageWriters are found
        IOException
    • Method Detail

      • close

        public void close()
                   throws IOException
        Close this GifSequenceWriter object. This does not close the underlying stream, just finishes off the GIF.
        Throws:
        IOException - if there is a problem writing the last bytes.
      • main

        public static void main​(String[] args)
                         throws Exception
        Support invocation from the command line; provide a list of input file names, followed by a single output file name.
        Parameters:
        args - the names of the image files to be combined into a GIF sequence, folloewd by the output file name.
        Throws:
        Exception - if there is a problem reading the inputs or writing the output.