question: public void addImage ( RenderedImage image , int delayMillis , int transparencyColorIndex ) throws IOException { if ( this . counter == 0 ) { iiom = writer . getDefaultImageMetadata ( ImageTypeSpecifier . createFromRenderedImage ( image ) , iwp ) ; writer . prepareWriteSequence ( writer . getDefaultStreamMetadata ( iwp ) ) ; } if ( this . counter == 0 && loops >= 0 ) { IIOMetadata imageMetadata2 = writer . getDefaultImageMetadata ( ImageTypeSpecifier . createFromRenderedImage ( image ) , iwp ) ; try { setMetadata ( imageMetadata2 , delayMillis , transparencyColorIndex ) ; setLoops ( imageMetadata2 , this . loops ) ; writer . writeToSequence ( new IIOImage ( image , null , imageMetadata2 ) , iwp ) ; } catch ( final IIOInvalidTreeException e ) { throw new IOException ( e . getMessage ( ) ) ; } } else try { setMetadata ( iiom , delayMillis , transparencyColorIndex ) ; writer . writeToSequence ( new IIOImage ( image , null , iiom ) , iwp ) ; } catch ( final IIOInvalidTreeException e ) { throw new IOException ( e . getMessage ( ) ) ; } this . counter ++ ; }
target:  add an image to the animation