public class ImageMetadataReader extends Object
This class a lightweight wrapper around other, specific metadata processors. During extraction, the file type is determined from the first few bytes of the file. Parsing is then 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 filesIcoMetadataReader for ICO filesPcxMetadataReader for PCX filesWebpMetadataReader for WebP filesRafMetadataReader for RAF 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. |
static Metadata |
readMetadata(InputStream inputStream,
long streamLength)
Reads metadata from an
InputStream of known length. |
public static Metadata readMetadata(InputStream inputStream) throws ImageProcessingException, IOException
InputStream.inputStream - 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(InputStream inputStream, long streamLength) throws ImageProcessingException, IOException
InputStream of known length.inputStream - a stream from which the file data may be read. The stream must be positioned at the
beginning of the file's data.streamLength - the length of the stream, if known, otherwise -1.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
file - 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-2017 Drew Noakes. All Rights Reserved.