Class EXIFUtilities

java.lang.Object
com.twelvemonkeys.contrib.exif.EXIFUtilities

public class EXIFUtilities extends Object
EXIFUtilities.
Version:
: EXIFUtilities.java,v 1.0 23/06/2020
  • Constructor Details

    • EXIFUtilities

      public EXIFUtilities()
  • Method Details

    • readWithOrientation

      public static IIOImage readWithOrientation(URL input) throws IOException
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage. The returned IIOImage will always contain an image and no raster, and the RenderedImage may be safely cast to a BufferedImage. If no registered ImageReader claims to be able to read the input, null is returned.
      Parameters:
      input - a URL
      Returns:
      an IIOImage containing the correctly oriented image and metadata including rotation info, or null.
      Throws:
      IOException - if an error occurs during reading.
    • readWithOrientation

      public static IIOImage readWithOrientation(InputStream input) throws IOException
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage. The returned IIOImage will always contain an image and no raster, and the RenderedImage may be safely cast to a BufferedImage. If no registered ImageReader claims to be able to read the input, null is returned.
      Parameters:
      input - an InputStream
      Returns:
      an IIOImage containing the correctly oriented image and metadata including rotation info, or null.
      Throws:
      IOException - if an error occurs during reading.
    • readWithOrientation

      public static IIOImage readWithOrientation(File input) throws IOException
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage. The returned IIOImage will always contain an image and no raster, and the RenderedImage may be safely cast to a BufferedImage. If no registered ImageReader claims to be able to read the input, null is returned.
      Parameters:
      input - a File
      Returns:
      an IIOImage containing the correctly oriented image and metadata including rotation info or null.
      Throws:
      IOException - if an error occurs during reading.
    • readWithOrientation

      public static IIOImage readWithOrientation(ImageInputStream input) throws IOException
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage. The returned IIOImage will always contain an image and no raster, and the RenderedImage may be safely cast to a BufferedImage. If no registered ImageReader claims to be able to read the input, null is returned.
      Parameters:
      input - an ImageInputStream
      Returns:
      an IIOImage containing the correctly oriented image and metadata including rotation info, or null.
      Throws:
      IOException - if an error occurs during reading.
    • findImageOrientation

      public static Orientation findImageOrientation(IIOMetadata metadata)
      Finds the ImageOrientation tag, if any, and returns an Orientation based on its value attribute. If no match is found or the tag is not present, Normal (the default orientation) is returned.
      Parameters:
      metadata - an IIOMetadata object
      Returns:
      the Orientation matching the value attribute of the ImageOrientation tag, or Normal, never null.
      See Also:
    • main

      public static void main(String[] args) throws IOException
      Throws:
      IOException