Class RawTiffParser

All Implemented Interfaces:
Serializable, SelfConfiguring, EnrichingParser, Parser

public class RawTiffParser extends TiffParser
Parser for TIFF-based camera raw images: Nikon NEF/NRW, Sony ARW/SRF/SR2, Pentax PEF/PTX, Samsung SRW, Epson ERF, Kodak KDC, Leaf MOS, Adobe DNG, Canon CR2, Olympus ORF and Panasonic RW2.

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: