Package org.apache.tika.parser.image
Class ImageMetadataExtractor
java.lang.Object
org.apache.tika.parser.image.ImageMetadataExtractor
Uses the Metadata Extractor library
to read EXIF and IPTC image metadata and map to Tika fields.
As of 2.4.0 the library supports jpeg and tiff.
As of 2.8.0 the library supports webp.
-
Constructor Summary
ConstructorDescriptionImageMetadataExtractor
(Metadata metadata) ImageMetadataExtractor
(Metadata metadata, org.apache.tika.parser.image.ImageMetadataExtractor.DirectoryHandler... handlers) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
handle
(com.drew.metadata.Metadata metadataExtractor) Copies extracted tags to tika metadata using registered handlers.protected void
Copies extracted tags to tika metadata using registered handlers.void
parseHeif
(InputStream is) void
void
parseRawExif
(byte[] exifData) void
parseRawExif
(InputStream stream, int length, boolean needsExifHeader) void
parseRawXMP
(byte[] xmpData) void
void
-
Constructor Details
-
ImageMetadataExtractor
- Parameters:
metadata
- to extract to, using default directory handlers
-
ImageMetadataExtractor
public ImageMetadataExtractor(Metadata metadata, org.apache.tika.parser.image.ImageMetadataExtractor.DirectoryHandler... handlers) - Parameters:
metadata
- to extract tohandlers
- handlers in order, note that handlers may override values from earlier handlers
-
-
Method Details
-
parseJpeg
- Throws:
IOException
SAXException
TikaException
-
parseTiff
- Throws:
IOException
SAXException
TikaException
-
parseWebP
- Throws:
IOException
TikaException
-
parseHeif
- Throws:
IOException
TikaException
-
parseRawExif
public void parseRawExif(InputStream stream, int length, boolean needsExifHeader) throws IOException, SAXException, TikaException - Throws:
IOException
SAXException
TikaException
-
parseRawExif
- Throws:
IOException
SAXException
TikaException
-
parseRawXMP
- Throws:
IOException
SAXException
TikaException
-
handle
protected void handle(com.drew.metadata.Metadata metadataExtractor) throws com.drew.metadata.MetadataException Copies extracted tags to tika metadata using registered handlers.- Parameters:
metadataExtractor
- Tag directories from a Metadata Extractor "reader"- Throws:
com.drew.metadata.MetadataException
- This method does not handle exceptions from Metadata Extractor
-
handle
protected void handle(Iterator<com.drew.metadata.Directory> directories) throws com.drew.metadata.MetadataException Copies extracted tags to tika metadata using registered handlers.- Parameters:
directories
- Metadata ExtractorDirectory
instances.- Throws:
com.drew.metadata.MetadataException
- This method does not handle exceptions from Metadata Extractor
-