Class StreamingGifWriter


  • public class StreamingGifWriter
    extends java.lang.Object
    Baseed on work by Elliot Kroo on 2009-04-25 and adapted into Java and rewritten.

    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.

    Typical usage will look something like: {{{ import com.sksamuel.scrimage.nio.StreamingGifWriter val stream = StreamingGifWriter() stream.prepareStream("/path/to/gif.gif", BufferedImage.TYPE_INT_ARGB) stream.writeFrame(image0) stream.writeFrame(image1) stream.writeFrame(imageN) stream.finish() }}}

    • Constructor Detail

      • StreamingGifWriter

        public StreamingGifWriter()
      • StreamingGifWriter

        public StreamingGifWriter​(java.time.Duration frameDelay,
                                  boolean infiniteLoop,
                                  boolean compressed)
    • Method Detail

      • prepareStream

        public StreamingGifWriter.GifStream prepareStream​(java.lang.String path,
                                                          int imageType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • prepareStream

        public StreamingGifWriter.GifStream prepareStream​(java.nio.file.Path path,
                                                          int imageType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • prepareStream

        public StreamingGifWriter.GifStream prepareStream​(java.io.File file,
                                                          int imageType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • prepareStream

        public StreamingGifWriter.GifStream prepareStream​(java.io.OutputStream output,
                                                          int imageType)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getNode

        protected javax.imageio.metadata.IIOMetadataNode getNode​(javax.imageio.metadata.IIOMetadataNode rootNode,
                                                                 java.lang.String nodeName)
        Returns an existing child node, or creates and returns a new child node (if the requested node does not exist).
        Parameters:
        rootNode - the IIOMetadataNode to search for the child node.
        nodeName - the name of the child node.
        Returns:
        the child node, if found or a new node created with the given name.
      • populateGraphicsControlNode

        protected void populateGraphicsControlNode​(javax.imageio.metadata.IIOMetadataNode root,
                                                   java.time.Duration frameDelay)
      • populateCommentsNode

        protected void populateCommentsNode​(javax.imageio.metadata.IIOMetadataNode root)
      • populateApplicationExtensions

        protected void populateApplicationExtensions​(javax.imageio.metadata.IIOMetadataNode root,
                                                     boolean infiniteLoop)