Class HeicDecoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.heic.HeicDecoder
All Implemented Interfaces:
com.idrsolutions.image.Decoder

public class HeicDecoder extends com.idrsolutions.image.JDeliImage implements com.idrsolutions.image.Decoder
Class reads HEIC images as BufferedImage. Make no assumptions about the type of BufferedImage returned (may change).

Example:


 HeicDecoder decoder = new HeicDecoder();
 BufferedImage decodedImage = decoder.read(heicFile);
 
  • Field Summary

    Fields inherited from class com.idrsolutions.image.JDeliImage

    bb
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isReadable(byte[] data)
    Checks whether the heic image data can be decoded, by validating its structure without decoding the pixels
    boolean
    isReadable(File imageFile)
    Checks whether the heic image file can be decoded, by validating its structure without decoding the pixels
    read(byte[] data)
     
    read(File file)
     
    readDimension(byte[] data)
    Decodes and returns the width and height of heic image
    Decodes and returns the width and height of heic image
    readEmbeddedThumbnail(byte[] data)
    Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
    Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
    readExif(byte[] data)
    Decodes and returns the Exif data as IFD format if there is an IFDdata otherwise returns null
    readExif(File file)
    Decodes and returns the Exif data as IFD format if there is an IFDdata otherwise returns null
    void
    readImageSpecificMetaData(byte[] bytes, Metadata metadata)
    Read Heic specific metadata such as IFD
    void
    Read Heic specific metadata such as IFD

    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, readImageAt, readImageAt, setMetadata
  • Constructor Details

    • HeicDecoder

      public HeicDecoder()
  • Method Details

    • read

      public BufferedImage read(byte[] data) throws Exception
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      data - source image to read
      Returns:
      image contained in raw data
      Throws:
      Exception - if problem reading image
    • read

      public BufferedImage read(File file) throws Exception
      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      file - source image to read
      Returns:
      image contained in raw data
      Throws:
      Exception - if problem reading image
    • readEmbeddedThumbnail

      public BufferedImage readEmbeddedThumbnail(File file) throws Exception
      Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
      Specified by:
      readEmbeddedThumbnail in interface com.idrsolutions.image.Decoder
      Parameters:
      file - heic file
      Returns:
      BufferedImage thumbnail image
      Throws:
      Exception - if problem reading image
    • readEmbeddedThumbnail

      public BufferedImage readEmbeddedThumbnail(byte[] data) throws Exception
      Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
      Specified by:
      readEmbeddedThumbnail in interface com.idrsolutions.image.Decoder
      Parameters:
      data - image image contained in raw data if present
      Returns:
      BufferedImage thumbnail image
      Throws:
      Exception - if problem reading image
    • readExif

      public Exif readExif(File file) throws Exception
      Decodes and returns the Exif data as IFD format if there is an IFDdata otherwise returns null
      Parameters:
      file - image image contained in raw data if present
      Returns:
      BufferedImage thumbnail image
      Throws:
      Exception - if problem reading image
    • readExif

      public Exif readExif(byte[] data) throws Exception
      Decodes and returns the Exif data as IFD format if there is an IFDdata otherwise returns null
      Parameters:
      data - image image contained in raw data if present
      Returns:
      BufferedImage thumbnail image
      Throws:
      Exception - if problem reading image
    • readDimension

      public Rectangle readDimension(File file) throws Exception
      Decodes and returns the width and height of heic 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
    • isReadable

      public boolean isReadable(byte[] data) throws Exception
      Checks whether the heic image data can be decoded, by validating its structure without decoding the pixels
      Specified by:
      isReadable in interface com.idrsolutions.image.Decoder
      Parameters:
      data - heic image data
      Returns:
      true if the image can be decoded
      Throws:
      Exception - if problem reading image
    • isReadable

      public boolean isReadable(File imageFile) throws Exception
      Checks whether the heic image file can be decoded, by validating its structure without decoding the pixels
      Specified by:
      isReadable in interface com.idrsolutions.image.Decoder
      Parameters:
      imageFile - heic image file
      Returns:
      true if the image can be decoded
      Throws:
      Exception - if problem reading image
    • readDimension

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

      public void readImageSpecificMetaData(File file, Metadata metadata) throws Exception
      Read Heic specific metadata such as IFD
      Specified by:
      readImageSpecificMetaData in interface com.idrsolutions.image.Decoder
      Parameters:
      file - file to read from
      metadata - image metadata object to hold all metadata
      Throws:
      Exception
    • readImageSpecificMetaData

      public void readImageSpecificMetaData(byte[] bytes, Metadata metadata) throws Exception
      Read Heic specific metadata such as IFD
      Specified by:
      readImageSpecificMetaData in interface com.idrsolutions.image.Decoder
      Parameters:
      bytes - byte array to read data from
      metadata - image metadata object to hold all metadata
      Throws:
      Exception