Home » Tika Extracting Image

Tika Extracting Image

by Online Tutorials Library

Tika Image Extraction

Tika ImageParser is a class that is used to extract content and metadata from a image file. This class is stored into the org.apache.tika.parser.image package. It contains the constructor and methods, that are tabled here, see below.

Tika ImageParser Constructor

Constructor Description
public ImageParser() It is used to create instance of the class.

Tika ImageParser Methods

Following are the methods of ImageParser Class.

Method Description
public Set<MediaType> getSupportedTypes(ParseContext context) Returns the set of media types supported by this parser when used with the given parse context.
public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException Parses a document stream into a sequence of XHTML SAX events. Fills in related document metadata in the given metadata object.

Tika Image Parser Example

In this example, we are extracting content and metadat of an image file. See the example.

Output:

Document Content :  Document Metadata :  Exif Versi2on: 2.30  Brightness: 0  Compression Type: Baseline  Image Description:   Number of Components: 3  Component 2: Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert  Focal Length: 4.1 mm  Component 1: Y component: Quantization table 0, Sampling factors 2 horiz/1 vert  Unknown tag (0x9410): [3656 values]  tiff:ResolutionUnit: Inch  Date/Time Original: 2015:06:11 20:53:00  tiff:Make: SONY  Unknown tag (0x201f): 0 0 0 0  Unknown tag (0x200d): 1  Flash Level: Normal  Component 3: Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert  Flash Exposure Compensation: 0 EV  Unknown tag (0xb046): 0  F-Number: f/3.5  Unknown tag (0x2015): 65535  Focus Mode: Manual  Sensitivity Type: Recommended Exposure Index  tiff:BitsPerSample: 8  Unknown tag (0x0002): 0x00000001  Unknown tag (0x2027): 4896 3672 4375 1897  

You may also like