Class EXIFUtilities


  • public class EXIFUtilities
    extends java.lang.Object
    EXIFUtilities.
    Version:
    : EXIFUtilities.java,v 1.0 23/06/2020
    Author:
    Harald Kuhr
    • Constructor Summary

      Constructors 
      Constructor Description
      EXIFUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Orientation findImageOrientation​(javax.imageio.metadata.IIOMetadata metadata)
      Finds the ImageOrientation tag, if any, and returns an Orientation based on its value attribute.
      static void main​(java.lang.String[] args)  
      static javax.imageio.IIOImage readWithOrientation​(java.io.File input)
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
      static javax.imageio.IIOImage readWithOrientation​(java.io.InputStream input)
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
      static javax.imageio.IIOImage readWithOrientation​(java.net.URL input)
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
      static javax.imageio.IIOImage readWithOrientation​(javax.imageio.stream.ImageInputStream input)
      Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EXIFUtilities

        public EXIFUtilities()
    • Method Detail

      • readWithOrientation

        public static javax.imageio.IIOImage readWithOrientation​(java.net.URL input)
                                                          throws java.io.IOException
        Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
        Parameters:
        input - a URL
        Returns:
        an IIOImage containing the correctly oriented image and metadata including rotation info.
        Throws:
        java.io.IOException - if an error occurs during reading.
      • readWithOrientation

        public static javax.imageio.IIOImage readWithOrientation​(java.io.InputStream input)
                                                          throws java.io.IOException
        Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
        Parameters:
        input - an InputStream
        Returns:
        an IIOImage containing the correctly oriented image and metadata including rotation info.
        Throws:
        java.io.IOException - if an error occurs during reading.
      • readWithOrientation

        public static javax.imageio.IIOImage readWithOrientation​(java.io.File input)
                                                          throws java.io.IOException
        Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
        Parameters:
        input - a File
        Returns:
        an IIOImage containing the correctly oriented image and metadata including rotation info.
        Throws:
        java.io.IOException - if an error occurs during reading.
      • readWithOrientation

        public static javax.imageio.IIOImage readWithOrientation​(javax.imageio.stream.ImageInputStream input)
                                                          throws java.io.IOException
        Reads image and metadata, applies Exif orientation to image, and returns everything as an IIOImage.
        Parameters:
        input - an ImageInputStream
        Returns:
        an IIOImage containing the correctly oriented image and metadata including rotation info.
        Throws:
        java.io.IOException - if an error occurs during reading.
      • findImageOrientation

        public static Orientation findImageOrientation​(javax.imageio.metadata.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:
        Orientation, Standard (Plug-in Neutral) Metadata Format Specification
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException