Package com.twelvemonkeys.contrib.exif
Class EXIFUtilities
- java.lang.Object
-
- com.twelvemonkeys.contrib.exif.EXIFUtilities
-
public class EXIFUtilities extends java.lang.ObjectEXIFUtilities.- Version:
- : EXIFUtilities.java,v 1.0 23/06/2020
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classEXIFUtilities.DisplayHelper
-
Constructor Summary
Constructors Constructor Description EXIFUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OrientationfindImageOrientation(javax.imageio.metadata.IIOMetadata metadata)static voidmain(java.lang.String[] args)static javax.imageio.IIOImagereadWithOrientation(java.io.File input)Reads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage.static javax.imageio.IIOImagereadWithOrientation(java.io.InputStream input)Reads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage.static javax.imageio.IIOImagereadWithOrientation(java.net.URL input)Reads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage.static javax.imageio.IIOImagereadWithOrientation(javax.imageio.stream.ImageInputStream input)Reads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage.
-
-
-
Method Detail
-
readWithOrientation
public static javax.imageio.IIOImage readWithOrientation(java.net.URL input) throws java.io.IOExceptionReads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage. The returnedIIOImagewill always contain an image and no raster, and theRenderedImagemay be safely cast to aBufferedImage. If no registeredImageReaderclaims to be able to read the input,nullis returned.- Parameters:
input- aURL- Returns:
- an
IIOImagecontaining the correctly oriented image and metadata including rotation info, ornull. - Throws:
java.io.IOException- if an error occurs during reading.
-
readWithOrientation
public static javax.imageio.IIOImage readWithOrientation(java.io.InputStream input) throws java.io.IOExceptionReads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage. The returnedIIOImagewill always contain an image and no raster, and theRenderedImagemay be safely cast to aBufferedImage. If no registeredImageReaderclaims to be able to read the input,nullis returned.- Parameters:
input- anInputStream- Returns:
- an
IIOImagecontaining the correctly oriented image and metadata including rotation info, ornull. - Throws:
java.io.IOException- if an error occurs during reading.
-
readWithOrientation
public static javax.imageio.IIOImage readWithOrientation(java.io.File input) throws java.io.IOExceptionReads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage. The returnedIIOImagewill always contain an image and no raster, and theRenderedImagemay be safely cast to aBufferedImage. If no registeredImageReaderclaims to be able to read the input,nullis returned.- Parameters:
input- aFile- Returns:
- an
IIOImagecontaining the correctly oriented image and metadata including rotation info ornull. - 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.IOExceptionReads image and metadata, applies Exif orientation to image, and returns everything as anIIOImage. The returnedIIOImagewill always contain an image and no raster, and theRenderedImagemay be safely cast to aBufferedImage. If no registeredImageReaderclaims to be able to read the input,nullis returned.- Parameters:
input- anImageInputStream- Returns:
- an
IIOImagecontaining the correctly oriented image and metadata including rotation info, ornull. - Throws:
java.io.IOException- if an error occurs during reading.
-
findImageOrientation
public static Orientation findImageOrientation(javax.imageio.metadata.IIOMetadata metadata)
Finds theImageOrientationtag, if any, and returns anOrientationbased on itsvalueattribute. If no match is found or the tag is not present,Normal(the default orientation) is returned.- Parameters:
metadata- anIIOMetadataobject- Returns:
- the
Orientationmatching thevalueattribute of theImageOrientationtag, orNormal, nevernull. - 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
-
-