Class AnimationInfo

java.lang.Object
dev.matrixlab.webp4j.model.AnimationInfo

public class AnimationInfo extends Object
Holds animation metadata extracted from GIF images.

This class provides information about a GIF image without performing the full conversion. It's useful for determining whether a GIF is animated, its dimensions, and other properties before conversion.

Instances of this class are immutable after being populated by the native layer or GIF decoder.

  • Constructor Details

    • AnimationInfo

      public AnimationInfo()
      Public constructor. Instances can be created by any code including WebPCodec, native code, or external packages.
  • Method Details

    • getFrameCount

      public int getFrameCount()
      Gets the number of frames in the GIF animation.
      Returns:
      Frame count (1 for static GIF, >1 for animated GIF)
    • setFrameCount

      public void setFrameCount(int frameCount)
      Called by WebPCodec or native code.
    • getWidth

      public int getWidth()
      Gets the width of the GIF image in pixels.
      Returns:
      Image width
    • setWidth

      public void setWidth(int width)
      Called by WebPCodec or native code.
    • getHeight

      public int getHeight()
      Gets the height of the GIF image in pixels.
      Returns:
      Image height
    • setHeight

      public void setHeight(int height)
      Called by WebPCodec or native code.
    • getLoopCount

      public int getLoopCount()
      Gets the loop count for the animation.
      Returns:
      Loop count (0=infinite loop, N=loop N times)
    • setLoopCount

      public void setLoopCount(int loopCount)
      Called by WebPCodec or native code.
    • hasTransparency

      public boolean hasTransparency()
      Checks if the GIF has transparency (transparent color index).
      Returns:
      true if the GIF has at least one transparent pixel
    • setHasTransparency

      public void setHasTransparency(boolean hasTransparency)
      Called by WebPCodec or native code.
    • isAnimated

      public boolean isAnimated()
      Checks if the GIF is animated (has multiple frames).
      Returns:
      true if frame count > 1
    • toString

      public String toString()
      Overrides:
      toString in class Object