Class RawTiffParser
- All Implemented Interfaces:
Serializable,SelfConfiguring,EnrichingParser,Parser
These formats are TIFF containers: metadata extraction is inherited from
TiffParser. In addition, this parser extracts the camera-generated
JPEG preview images embedded in the raw file and hands them to the
EmbeddedDocumentExtractor. Previews are referenced from the IFD
chain or from SubIFDs, either via the JPEGInterchangeFormat/
JPEGInterchangeFormatLength tags or as a single JPEG-compressed strip
(DNG, CR2). Four formats keep theirs elsewhere. A Panasonic RW2 uses the
private JpgFromRaw tag. An Olympus ORF uses its MakerNote, whose own IFD
holds the camera thumbnail and the CameraSettings sub-IFD that points at
the preview. An Epson ERF uses its MakerNote too, under a tag of its own,
at an offset counted from the start of the file and behind a byte the
camera writes over the JPEG's first one, which is put back on the way out.
A Leaf MOS uses a vendor block of named sections, one of which holds the
JPEG. ORF and RW2 carry a magic number of their own; ERF, KDC and MOS are
plain TIFFs, and a KDC names its preview the way a TIFF does.
Strips holding raw sensor data are also JPEG-encoded in some formats (lossless JPEG in CR2 and DNG), so strip candidates are only accepted for displayable images: PhotometricInterpretation RGB or YCbCr, or 8 bits per sample when PhotometricInterpretation is absent (CR2). Both classic TIFF and BigTIFF containers (allowed for DNG since spec version 1.7) are supported.
Of the previews that are extracted (see the length limits in
RawTiffParser.RawTiffParserConfig), the largest by JPEG byte length is marked
TikaCoreProperties.EmbeddedResourceType.THUMBNAIL, any smaller
ones are TikaCoreProperties.EmbeddedResourceType.INLINE images
(TIKA-4851).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration class for RawTiffParser. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ImageMetadataConfiggetImageMetadataConfig(ParseContext context) getSupportedTypes(ParseContext context) Returns the set of media types supported by this parser when used with the given parse context.voidparse(TikaInputStream tis, ContentHandler handler, Metadata metadata, ParseContext context) Parses a document stream into a sequence of XHTML SAX events.Methods inherited from class org.apache.tika.parser.image.AbstractImageParser
setContentEnrichers
-
Constructor Details
-
RawTiffParser
public RawTiffParser() -
RawTiffParser
-
RawTiffParser
-
-
Method Details
-
getSupportedTypes
Description copied from interface:ParserReturns the set of media types supported by this parser when used with the given parse context.- Specified by:
getSupportedTypesin interfaceParser- Overrides:
getSupportedTypesin classTiffParser- Parameters:
context- parse context- Returns:
- immutable set of media types
-
parse
public void parse(TikaInputStream tis, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException Description copied from interface:ParserParses a document stream into a sequence of XHTML SAX events. Fills in related document metadata in the given metadata object.The given document stream is consumed but not closed by this method. The responsibility to close the stream remains on the caller.
Information about the parsing context can be passed in the context parameter. See the parser implementations for the kinds of context information they expect.
- Specified by:
parsein interfaceParser- Overrides:
parsein classAbstractImageParser- Parameters:
handler- handler for the XHTML SAX events (output)metadata- document metadata (input and output)context- parse context- Throws:
IOException- if the document stream could not be readSAXException- if the SAX events could not be processedTikaException- if the document could not be parsed
-
getImageMetadataConfig
protected ImageMetadataConfig getImageMetadataConfig(ParseContext context) throws TikaException, IOException - Overrides:
getImageMetadataConfigin classTiffParser- Throws:
TikaExceptionIOException
-