Link
Skip to main content

How to Read Image Metadata Using Apache Tika

Many image formats include metadata about the Image. JDeli provides an Apache Tika plugin to extract image metadata.

Note: you will need Apache Tika on your classpath to use this feature. You can download Tika here.

Currently, we support the following formats:

  • BMP
  • GIF
  • HEIC/HEIF
  • JPEG/JPG
  • JPX/JP2
  • JXL
  • PNG
  • TIFF/TIF
  • WEBP

Example Usage

try (final TikaInputStream tik = TikaInputStream.get(Paths.get(file))) {
    final MetadataParser parser = new MetadataParser();
    
    final ToXMLContentHandler xmlH = new ToXMLContentHandler();
    
    // Ability to set a password if necessary
    final Metadata metadata = new Metadata();
    // metadata.set(PDFParser.PASSWORD, "password");
    
    // parseContext is not required so can be null
    parser.parse(tik, xmlH, metadata, null);
} catch (final IOException | SAXException | TikaException e) {
    e.printStackTrace();
}

Get started with JDeli in 3 steps

  1. Fill in the form to download the trial jar →
  2. Copy the code snippets as instructed on the next page
  3. Build your solution using our docs

Learn more about JDeli

Start Your Free Trial