Class GifSequenceWriter

java.lang.Object
net.targetr.tncaptcha.GifSequenceWriter

public class GifSequenceWriter extends Object
Utility class for writing a sequence of images as an animated GIF.
  • Field Details

    • writer

      protected ImageWriter writer
      The image writer used to create the GIF sequence.
    • params

      protected ImageWriteParam params
      The write parameters for the image writer.
    • metadata

      protected IIOMetadata metadata
      The metadata associated with the GIF sequence.
  • Constructor Details

    • GifSequenceWriter

      public GifSequenceWriter(ImageOutputStream out, int imageType, int delay, boolean loop) throws IOException
      Constructs a new GifSequenceWriter.
      Parameters:
      out - the output stream
      imageType - the type of the image
      delay - the delay between frames in milliseconds
      loop - whether the sequence should loop continuously
      Throws:
      IOException - if an I/O error occurs
  • Method Details

    • writeToSequence

      public void writeToSequence(RenderedImage img) throws IOException
      Writes a new frame to the GIF sequence.
      Parameters:
      img - the image to write
      Throws:
      IOException - if an I/O error occurs
    • close

      public void close() throws IOException
      Closes the GIF sequence writer and finishes writing the sequence.
      Throws:
      IOException - if an I/O error occurs