[ 
https://issues.apache.org/jira/browse/TIKA-4824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dominik Schmidt updated TIKA-4824:
----------------------------------
    Description: 
TIFF-based camera raw files embed camera-generated JPEG previews, often at full 
resolution. Tika currently gives no access to them: the x-raw-* types are 
glob-only (not sub-classes of image/tiff), no parser claims them, and nothing 
extracts the preview bytes. For consumers that cannot decode raw sensor data, 
the embedded JPEG is the only practical way to render a raw file (analogous to 
TIKA-4801 for audio cover art).

The previews are stored in two ways:

- Nikon NEF/NRW, Sony ARW/SRF/SR2, Pentax PEF/PTX: 
JPEGInterchangeFormat/-Length tags in the IFD chain or in SubIFDs
- Adobe DNG, Canon CR2: a single JPEG-compressed strip (Compression 6/7)

Proposal:

- New RawTiffParser in tika-parser-image-module claiming 
image/x-raw-{nikon,sony,pentax,adobe} and image/x-canon-cr2: TIFF/EXIF/XMP 
metadata via TiffParser, walks the IFD chain plus SubIFDs and emits each 
preview through the EmbeddedDocumentExtractor (image/jpeg, THUMBNAIL); 
configurable via "raw-tiff-parser": {"extractPreviews": false}
- Strip candidates need a safety rule: raw sensor data in CR2/DNG is lossless 
JPEG and also starts with an SOI marker. Strips are only accepted for 
displayable images (PhotometricInterpretation RGB/YCbCr, or 8 bits per sample 
when it is absent, as in CR2's preview IFD)
- Make image/x-raw-{nikon,sony,pentax,adobe} sub-classes of image/tiff so 
name+data detection resolves them (they have no reliable magic; data-only 
detection stays image/tiff)
- Synthetic ~2KB test fixtures mirroring the real IFD layouts, unit and 
detection tests

Evaluated and excluded: Epson ERF (preview lives in the MakerNote), Olympus ORF 
and Panasonic RW2 (non-standard TIFF magic), Fuji RAF (not TIFF), Canon CR3 
(ISO-BMFF). Verified against CC0 samples from raw.pixls.us (NEX-6, DSC-R1, K-7, 
EOS 7D, K-x and GR DNGs) plus real Nikon D80/D3000 files.

PR to follow.

  was:
NEF/NRW files are TIFF-based and embed a camera-generated full-resolution JPEG 
preview (SubIFD0, JPEGInterchangeFormat/-Length). Tika currently has no access 
to it: image/x-raw-nikon is glob-only and not a sub-class of image/tiff, no 
parser claims the type, and nothing extracts the preview bytes. For consumers 
that cannot decode raw sensor data, the embedded JPEG is the only practical way 
to render a NEF (analogous to TIKA-4801 for audio cover art).

Proposal:

- New NEFParser in tika-parser-image-module: TIFF metadata via TiffParser, 
walks IFD0 + SubIFDs and emits each JPEG preview through the 
EmbeddedDocumentExtractor (image/jpeg, THUMBNAIL); configurable via 
"nef-parser": {"extractPreviews": false}
- Add sub-class-of image/tiff to image/x-raw-nikon so name+data detection 
resolves NEF
- Synthetic ~2KB test NEF mirroring the real IFD layout, unit and detection 
tests

PR to follow.


> Extract embedded JPEG previews from TIFF-based raw images (NEF, ARW, PEF, 
> DNG, CR2)
> -----------------------------------------------------------------------------------
>
>                 Key: TIKA-4824
>                 URL: https://issues.apache.org/jira/browse/TIKA-4824
>             Project: Tika
>          Issue Type: New Feature
>            Reporter: Dominik Schmidt
>            Priority: Major
>
> TIFF-based camera raw files embed camera-generated JPEG previews, often at 
> full resolution. Tika currently gives no access to them: the x-raw-* types 
> are glob-only (not sub-classes of image/tiff), no parser claims them, and 
> nothing extracts the preview bytes. For consumers that cannot decode raw 
> sensor data, the embedded JPEG is the only practical way to render a raw file 
> (analogous to TIKA-4801 for audio cover art).
> The previews are stored in two ways:
> - Nikon NEF/NRW, Sony ARW/SRF/SR2, Pentax PEF/PTX: 
> JPEGInterchangeFormat/-Length tags in the IFD chain or in SubIFDs
> - Adobe DNG, Canon CR2: a single JPEG-compressed strip (Compression 6/7)
> Proposal:
> - New RawTiffParser in tika-parser-image-module claiming 
> image/x-raw-{nikon,sony,pentax,adobe} and image/x-canon-cr2: TIFF/EXIF/XMP 
> metadata via TiffParser, walks the IFD chain plus SubIFDs and emits each 
> preview through the EmbeddedDocumentExtractor (image/jpeg, THUMBNAIL); 
> configurable via "raw-tiff-parser": {"extractPreviews": false}
> - Strip candidates need a safety rule: raw sensor data in CR2/DNG is lossless 
> JPEG and also starts with an SOI marker. Strips are only accepted for 
> displayable images (PhotometricInterpretation RGB/YCbCr, or 8 bits per sample 
> when it is absent, as in CR2's preview IFD)
> - Make image/x-raw-{nikon,sony,pentax,adobe} sub-classes of image/tiff so 
> name+data detection resolves them (they have no reliable magic; data-only 
> detection stays image/tiff)
> - Synthetic ~2KB test fixtures mirroring the real IFD layouts, unit and 
> detection tests
> Evaluated and excluded: Epson ERF (preview lives in the MakerNote), Olympus 
> ORF and Panasonic RW2 (non-standard TIFF magic), Fuji RAF (not TIFF), Canon 
> CR3 (ISO-BMFF). Verified against CC0 samples from raw.pixls.us (NEX-6, 
> DSC-R1, K-7, EOS 7D, K-x and GR DNGs) plus real Nikon D80/D3000 files.
> PR to follow.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to