dschmidt opened a new pull request, #3370:
URL: https://github.com/apache/tika/pull/3370

   Fixes https://issues.apache.org/jira/browse/TIKA-4980
   
   Three TIFF-based raw formats produced no preview, each for its own reason.
   
   **Epson ERF** is now detected as a raw by its compression code (32769) and 
its Make ("SEIKO EPSON"), and `image/x-raw-epson` gains `sub-class-of 
image/tiff`. The registry line is not cosmetic: without it a detector returning 
that type would leave the file with no parser and nothing to fall back on, 
where today TiffParser at least reads its metadata. It also makes the type 
reachable by a declared Content-Type, which MimeTypes only accepts as a 
refinement of what it detected.
   
   **Olympus ORF and Panasonic RW2** are classic TIFF layouts behind their own 
magic number (0x4F52/0x5352 and 0x0055), which `locateJpegPreviews()` rejected 
outright. Their previews are not in the standard tags either: RW2 keeps its 
JPEG in the private JpgFromRaw tag 0x002E while its strip tags are 
placeholders, ORF keeps the camera thumbnail and the preview in the MakerNote, 
addressed relative to the MakerNote's first byte (0x0100, and 0x2020 
CameraSettings -> 0x0101/0x0102). Only the `OLYMPUS\0II` header is read; the 
older `OLYMP\0` one addresses differently and is left alone.
   
   Verified against CC0 samples from raw.pixls.us:
   
   ```
   P3180165.ORF (E-M10)       image/x-raw-olympus     THUMBNAIL 3200x2400  
INLINE 160x120
   _7061961_copy.ORF (E-5)    image/x-raw-olympus     THUMBNAIL 3200x2400  
INLINE 160x120
   RAW_PANASONIC_DMC-GX-7_11  image/x-raw-panasonic   THUMBNAIL 1920x1920
   Lumix_DMC-LX100_1.RW2      image/x-raw-panasonic   THUMBNAIL 1920x1440
   ```
   
   The largest preview by JPEG length becomes the THUMBNAIL and the camera 
thumbnail an INLINE image, as TIKA-4851 set it up. Make, model and dimensions 
are extracted for all of them and none records a parse exception. An Epson R-D1 
sample carries no embedded JPEG at all, so it stays without a thumbnail; its 
detection and typing are fixed regardless.
   
   Tests use two hand-built files, `testORF.orf` (890 bytes) and `testRW2.rw2` 
(421 bytes), in the style of the existing raw test documents, plus the 
detection cases. `apache-rat:check` is clean on both touched modules.
   
   Not covered: the older Olympus `OLYMP\0` MakerNote header, Fuji RAF (not a 
TIFF container), and the vendor-level mime entries that carry no `sub-class-of` 
because they span several containers (`image/x-raw-canon` covers CRW, CR2 and 
CR3).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to