com.drew.imaging
public class ImageMetadataReader extends Object
Metadata from all supported file formats.
This class a lightweight wrapper around specific file type processors:
JpegMetadataReader for JPEG filesTiffMetadataReader for TIFF and (most) RAW filesPsdMetadataReader for Photoshop filesPngMetadataReader for BMP filesBmpMetadataReader for BMP filesGifMetadataReader for GIF files
FileTypeDetector is used to determine the provided image's file type, and therefore
the appropriate metadata reader to use.
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
An application entry point.
|
static Metadata |
readMetadata(File file)
|
static Metadata |
readMetadata(InputStream inputStream)
Reads metadata from an
InputStream. |
public static Metadata readMetadata(InputStream inputStream) throws ImageProcessingException, IOException
InputStream.
The file type is determined by inspecting the leading bytes of the stream, and parsing of the file is delegated to one of:
JpegMetadataReader for JPEG filesTiffMetadataReader for TIFF and (most) RAW filesPsdMetadataReader for Photoshop filesPngMetadataReader for PNG filesBmpMetadataReader for BMP filesGifMetadataReader for GIF filesinputStream - a stream from which the file data may be read. The stream must be positioned at the
beginning of the file's data.Metadata object containing directories of tags with values and any processing errors.ImageProcessingException - if the file type is unknown, or for general processing errors.IOExceptionpublic static Metadata readMetadata(File file) throws ImageProcessingException, IOException
Metadata from a File object.
The file type is determined by inspecting the leading bytes of the stream, and parsing of the file is delegated to one of:
JpegMetadataReader for JPEG filesTiffMetadataReader for TIFF and (most) RAW filesPsdMetadataReader for Photoshop filesPngMetadataReader for PNG filesBmpMetadataReader for BMP filesGifMetadataReader for GIF filesfile - a file from which the image data may be read.Metadata object containing directories of tags with values and any processing errors.ImageProcessingException - for general processing errors.IOExceptionpublic static void main(String[] args) throws MetadataException, IOException
System.out.
If -thumb is passed, then any thumbnail data will be written to a file with name of the
input file having .thumb.jpg appended.
If -markdown is passed, then output will be in markdown format.
If -hex is passed, then the ID of each tag will be displayed in hexadecimal.
args - the command line argumentsMetadataExceptionIOExceptionCopyright © 2002-2015 Drew Noakes. All Rights Reserved.