1212import java .awt .image .RenderedImage ;
1313import java .io .File ;
1414import java .io .IOException ;
15+ import java .time .Duration ;
1516import java .util .ArrayList ;
1617import java .util .Iterator ;
1718
@@ -44,7 +45,7 @@ public class GifSequenceWriter implements AutoCloseable
4445 *
4546 * @author Elliot Kroo (elliot[at]kroo[dot]net)
4647 */
47- public GifSequenceWriter (ImageOutputStream outputStream , int imageType , int timeBetweenFramesMS ,
48+ public GifSequenceWriter (ImageOutputStream outputStream , int imageType , Duration timeBetweenFramesMS ,
4849 boolean loopContinuously ) throws IIOException , IOException
4950 {
5051 // my method to create a writer
@@ -58,7 +59,7 @@ public GifSequenceWriter(ImageOutputStream outputStream, int imageType, int time
5859 graphicsControlExtensionNode .setAttribute ("disposalMethod" , "none" );
5960 graphicsControlExtensionNode .setAttribute ("userInputFlag" , "FALSE" );
6061 graphicsControlExtensionNode .setAttribute ("transparentColorFlag" , "FALSE" );
61- graphicsControlExtensionNode .setAttribute ("delayTime" , Integer . toString ( timeBetweenFramesMS / 10 ) );
62+ graphicsControlExtensionNode .setAttribute ("delayTime" , "" + timeBetweenFramesMS . toMillis () / 10 );
6263 graphicsControlExtensionNode .setAttribute ("transparentColorIndex" , "0" );
6364 IIOMetadataNode commentsNode = getNode (root , "CommentExtensions" );
6465 commentsNode .setAttribute ("CommentExtension" , "Created by MAH" );
@@ -73,7 +74,7 @@ public GifSequenceWriter(ImageOutputStream outputStream, int imageType, int time
7374 gifWriter .setOutput (outputStream );
7475 gifWriter .prepareWriteSequence (null );
7576 }
76- static File writeAnimatedGif (File imageFile , ArrayList <BufferedImage > images , int timeBetweenFramesMS )
77+ static File writeAnimatedGif (File imageFile , ArrayList <BufferedImage > images , Duration timeBetweenFramesMS )
7778 {
7879 try (ImageOutputStream output = new FileImageOutputStream (imageFile ))
7980 {
0 commit comments