I'm attempting to use the GIF ImageWriter to create an animated GIF in the following style:
<br /> ImageWriter gifWriter = ImageIO.getImageWritersByFormatName( "gif" ).next();<br /> gifWriter.setOutput( new FileImageOutputStream( new File( "test.gif" ) ) );<br /> gifWriter.prepareWriteSequence( null );</p> <p>/* 'image1', 'image2', and 'image3' were gleaned from other GIF files */</p> <p>gifWriter.writeToSequence( new IIOImage( image1, null, null ), null ) );<br /> gifWriter.writeToSequence( new IIOImage( image2, null, null ), null ) );<br /> gifWriter.writeToSequence( new IIOImage( image3, null, null ), null ) );<br /> ... etc<br /> gifWriter.endWriteSequence();<br />
What I end up with appears to be an image with all consituent frames superimposed upon one another. Is my ImageWriter usage wrong, or perhaps there is there some value I must set in the metadata to indicate that an animation is desired?
Any help is appreciated!