public class ImageOperations
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static ImageAngle |
getAngle(java.io.File jpegFile)
Returns the angle stored in the jpeg file.
|
static java.util.Date |
getDateTimeTaken(java.io.File jpegFile)
Returns the date and time when the photograph was taken, null if unable to retrieve.
|
static java.util.List<PhotoMetadata> |
getMetadata(java.io.File jpegFile)
Retrieve the metadata from an image file.
|
static boolean |
isImage(java.nio.file.Path path)
Equivalent functionality regarding
isImage(java.lang.String) . |
static boolean |
isImage(java.lang.String path)
Indicates if a path refers to an image or not.
|
static java.awt.image.BufferedImage |
rotate(java.awt.image.BufferedImage originalImage,
ImageAngle imageAngle)
Rotate an image with the appropriate angle.
|
static java.awt.image.BufferedImage |
scaleImage(java.awt.image.BufferedImage originalImage,
int newWidth,
int newHeight)
Scale an image down to a new size.
|
public static boolean isImage(java.lang.String path)
path
- a path to a filepublic static boolean isImage(java.nio.file.Path path)
isImage(java.lang.String)
.path
- public static ImageAngle getAngle(java.io.File jpegFile) throws com.drew.imaging.ImageProcessingException, java.io.IOException, com.drew.metadata.MetadataException
jpegFile
- file containing an imagecom.drew.imaging.ImageProcessingException
- if an image processing error occurredjava.io.IOException
- if a file error occurredcom.drew.metadata.MetadataException
- if the reading of the image metadata failed.public static java.awt.image.BufferedImage rotate(java.awt.image.BufferedImage originalImage, ImageAngle imageAngle)
originalImage
- the original image that needs to be rotatedimageAngle
- the image angle, may be null. In which case, the original
image is returned.public static java.awt.image.BufferedImage scaleImage(java.awt.image.BufferedImage originalImage, int newWidth, int newHeight)
originalImage
- the original imagenewWidth
- the new width in pixelsnewHeight
- the new height in pixelspublic static java.util.List<PhotoMetadata> getMetadata(java.io.File jpegFile) throws com.drew.imaging.ImageProcessingException, java.io.IOException
jpegFile
- the image filePhotoMetadata
com.drew.imaging.ImageProcessingException
- an image processing error occurred when
interpreting the image.java.io.IOException
- an error occurred when reading the filepublic static java.util.Date getDateTimeTaken(java.io.File jpegFile) throws com.drew.imaging.ImageProcessingException, java.io.IOException
jpegFile
- a file containing an image.com.drew.imaging.ImageProcessingException
- an image processing error occurred when
interpreting the image.java.io.IOException
- an error occurred when reading the file