Package com.sksamuel.scrimage.nio
Class StreamingGifWriter
- java.lang.Object
-
- com.sksamuel.scrimage.nio.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() }}}
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
StreamingGifWriter.GifStream
-
Constructor Summary
Constructors Constructor Description StreamingGifWriter()
StreamingGifWriter(java.time.Duration frameDelay, boolean infiniteLoop, boolean compressed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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).protected void
populateApplicationExtensions(javax.imageio.metadata.IIOMetadataNode root, boolean infiniteLoop)
protected void
populateCommentsNode(javax.imageio.metadata.IIOMetadataNode root)
protected void
populateGraphicsControlNode(javax.imageio.metadata.IIOMetadataNode root, java.time.Duration frameDelay)
StreamingGifWriter.GifStream
prepareStream(java.io.File file, int imageType)
StreamingGifWriter.GifStream
prepareStream(java.io.OutputStream output, int imageType)
StreamingGifWriter.GifStream
prepareStream(java.lang.String path, int imageType)
StreamingGifWriter.GifStream
prepareStream(java.nio.file.Path path, int imageType)
StreamingGifWriter
withCompression(boolean compressed)
StreamingGifWriter
withFrameDelay(java.time.Duration delay)
StreamingGifWriter
withInfiniteLoop(boolean infiniteLoop)
-
-
-
Method Detail
-
withFrameDelay
public StreamingGifWriter withFrameDelay(java.time.Duration delay)
-
withInfiniteLoop
public StreamingGifWriter withInfiniteLoop(boolean infiniteLoop)
-
withCompression
public StreamingGifWriter withCompression(boolean compressed)
-
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)
-
-