Class ExifUtils
- java.lang.Object
-
- net.coobird.thumbnailator.util.exif.ExifUtils
-
public final class ExifUtils extends java.lang.ObjectAn utility class used to obtain the orientation information from a given Exif metadata.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringEXIF_MAGIC_STRING
-
Constructor Summary
Constructors Modifier Constructor Description privateExifUtils()This class should not be instantiated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OrientationgetExifOrientation(javax.imageio.ImageReader reader, int imageIndex)Returns the orientation obtained from the Exif metadata.static OrientationgetOrientationFromExif(byte[] exifData)Returns the orientation obtained from the Exif metadata.private static IfdStructurereadIFD(byte[] ifd, java.nio.ByteOrder bo)
-
-
-
Field Detail
-
EXIF_MAGIC_STRING
private static final java.lang.String EXIF_MAGIC_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getExifOrientation
public static Orientation getExifOrientation(javax.imageio.ImageReader reader, int imageIndex) throws java.io.IOException
Returns the orientation obtained from the Exif metadata.- Parameters:
reader- AnImageReaderwhich is reading the target image.imageIndex- The index of the image from which the Exif metadata should be read from.- Returns:
- The orientation information obtained from the
Exif metadata, as a
Orientationenum. Returnsnullif no orientation is found. - Throws:
java.io.IOException- When an error occurs during reading.java.lang.IllegalArgumentException- If theImageReaderdoes not have the target image set, or if the reader does not have a JPEG open.
-
getOrientationFromExif
public static Orientation getOrientationFromExif(byte[] exifData)
Returns the orientation obtained from the Exif metadata.- Parameters:
exifData- A byte array containing Exif data.- Returns:
- The orientation information obtained from the
Exif metadata, as a
Orientationenum. Returnsnullif no orientation is found.
-
readIFD
private static IfdStructure readIFD(byte[] ifd, java.nio.ByteOrder bo)
-
-