Class WebpDecoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.webp.WebpDecoder
All Implemented Interfaces:
com.idrsolutions.image.Decoder

public class WebpDecoder extends com.idrsolutions.image.JDeliImage implements com.idrsolutions.image.Decoder
Class reads lossy WEBP images as BufferedImage // Make NO assumptions about type of BufferedImage type returned (may change)

Example:


 WebpDecoder decoder = new WebpDecoder();
 BufferedImage decodedImage = decoder.read(webpByteData);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    read(byte[] rawData)
    Make NO assumptions about type of BufferedImage type returned (may change)
    read(File imageFile)
     
    readDimension(byte[] rawData)
    Decodes and returns the width and height of webp image
    Decodes and returns the width and height of webp 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, readImageSpecificMetaData, setMetadata
  • Constructor Details

    • WebpDecoder

      public WebpDecoder()
  • Method Details

    • read

      public BufferedImage read(byte[] rawData) throws Exception
      Make NO assumptions about type of BufferedImage type returned (may change)

      Decodes and returns the WEBP image as a BufferedImage.

      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      rawData - byte[] array containing the WEBP data
      Returns:
      BufferedImage The decoded image
      Throws:
      Exception - if an error occurs in reading image
    • readDimension

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

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

      public BufferedImage read(File imageFile) throws Exception
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Throws:
      Exception