Class GifDecoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.gif.GifDecoder
All Implemented Interfaces:
com.idrsolutions.image.Decoder

public class GifDecoder extends com.idrsolutions.image.JDeliImage implements com.idrsolutions.image.Decoder
Class reads Gif image as BufferedImage

Example 1 (Using raw byte data):


 GifDecoder decoder = new GifDecoder();
 BufferedImage decodedImage = decoder.read(gifBytes);
 

Example 2 (Using File):


 GifDecoder decoder = new GifDecoder();
 BufferedImage decodedImage = decoder.read(gifFile);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    read(byte[] gifData)
    Decodes and returns the gif image as a BufferedImage from bytes
    read(File gifFile)
    Decodes and returns the gif image as a BufferedImage from file
    readDimension(byte[] gifData)
    Decodes and returns the width and height of gif image
    Decodes and returns the width and height of gif image

    Methods inherited from class com.idrsolutions.image.JDeliImage

    optimiseImage

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.idrsolutions.image.Decoder

    getImageCount, getImageCount, readEmbeddedThumbnail, readEmbeddedThumbnail, readImageAt, readImageAt, readImageSpecificMetaData, setMetadata
  • Constructor Details

    • GifDecoder

      public GifDecoder()
  • Method Details

    • read

      public BufferedImage read(byte[] gifData) throws IOException
      Decodes and returns the gif image as a BufferedImage from bytes
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      gifData - gif image as data bytes
      Returns:
      BufferedImage The decoded image
      Throws:
      IOException - if an error occurs in reading image
    • read

      public BufferedImage read(File gifFile) throws IOException
      Decodes and returns the gif image as a BufferedImage from file
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      gifFile - Path to gif image to be read
      Returns:
      BufferedImage The decoded image
      Throws:
      IOException - if an error occurs in reading image
    • readDimension

      public Rectangle readDimension(File gifFile) throws IOException
      Decodes and returns the width and height of gif image
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Parameters:
      gifFile - image image contained in raw data if present
      Returns:
      width and height of image
      Throws:
      IOException - if problem reading image
    • readDimension

      public Rectangle readDimension(byte[] gifData) throws IOException
      Decodes and returns the width and height of gif image
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Parameters:
      gifData - image image contained in raw data if present
      Returns:
      Rectangle width and height of image
      Throws:
      IOException - if problem reading image