You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/09/04 13:29:00 UTC
[jira] [Commented] (TIKA-4861) Content-based detection for TIFF-based raw camera formats (NEF, PEF, ARW, DNG, SRW) and for RAF, RW2 and MRW
[ https://issues.apache.org/jira/browse/TIKA-4861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111559#comment-18111559 ]
ASF GitHub Bot commented on TIKA-4861:
--------------------------------------
tballison opened a new pull request, #3130:
URL: https://github.com/apache/tika/pull/3130
…x bounds check
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for your contribution to [Apache Tika](https://tika.apache.org/)! Your help is appreciated!
Before opening the pull request, please verify that
* there is an open issue on the [Tika issue tracker](https://issues.apache.org/jira/projects/TIKA) which describes the problem or the improvement. We cannot accept pull requests without an issue because the change wouldn't be listed in the release notes.
* the issue ID (`TIKA-XXXX`)
- is referenced in the title of the pull request
- and placed in front of your commit messages surrounded by square brackets (`[TIKA-XXXX] Issue or pull request title`)
* commits are squashed into a single one (or few commits for larger changes)
* Tika builds and unit tests pass with `./mvnw clean install` (`clean test` alone cannot resolve the pipes plugin zips)
* if you used a generative AI tool: follow the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) (`Generated-by: <tool>` in the commit message), and consider running the pre-flight in `.skills/devs/pr-review/SKILL.md` — fix what it finds; don't paste its report here
* there should be no conflicts when merging the pull request branch into the *recent* `main` branch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulled `main` branch
* if you add new module that downstream users will depend upon add it to relevant group in `tika-bom/pom.xml`.
We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the [Tika mailing list](http://tika.apache.org/mail-lists.html). Thanks!
> Content-based detection for TIFF-based raw camera formats (NEF, PEF, ARW, DNG, SRW) and for RAF, RW2 and MRW
> -------------------------------------------------------------------------------------------------------------
>
> Key: TIKA-4861
> URL: https://issues.apache.org/jira/browse/TIKA-4861
> Project: Tika
> Issue Type: Improvement
> Components: detector
> Reporter: Dominik Schmidt
> Priority: Major
> Fix For: 4.1.0
>
>
> Most raw camera formats are still detected by file extension only. Without a name, a stream is detected as image/tiff (or application/octet-stream for the non-TIFF ones), parsed by the generic TIFF parser, and the previews RawTiffParser emits as THUMBNAIL embedded documents (TIKA-4824, TIKA-4851) are never seen. Clients that upload without a reliable file name, such as tika-server callers sending a bare body, get no thumbnail for these files.
> Two groups:
> 1. Formats with a fixed signature that tika-mimetypes.xml does not match yet: Fuji RAF starts with "FUJIFILMCCD-RAW", Panasonic RW2 with "IIU\0" (a TIFF variant with its own magic number 0x55), Minolta MRW with "\0MRM"; Olympus ORF also occurs big-endian as "MMOR" and as "IIRS" next to the "IIRO" we match. These are magic entries only. Canon CR2/CR3 already have theirs (TIKA-3991).
> 2. Formats that are valid TIFF files: Nikon NEF/NRW, Pentax PEF/PTX, Sony ARW/SRF/SR2, Samsung SRW and Adobe DNG. No fixed-offset magic can tell them from a plain TIFF, and the Make tag alone is not enough: Nikon and Pentax cameras also write real TIFFs with their name in Make. ExifTool identifies these by content in two steps: a DNGVersion tag (0xC612) means DNG, and a vendor-specific Compression value (0x0103) in any IFD names the format (34713 NEF, 32767 ARW, 65535 PEF, 32770 SRW). That misses uncompressed raws (Compression 1), which can be caught by the image data itself: a raw holds an image with PhotometricInterpretation 32803 (CFA) or 34892 (LinearRaw) in IFD0 or a SubIFD (0x014A), where a plain TIFF has 2 (RGB); there Make picks the vendor.
> Proposal: a Detector in tika-parser-image-module, registered via SPI, that only acts when the TIFF magic matches and reads the IFD chain and SubIFDs with a bounded reader (the one in RawTiffParser already handles classic TIFF and BigTIFF), applying those rules in that order and returning application/octet-stream otherwise so image/tiff stands. A caller-supplied type or file name keeps precedence as usual.
> Both parts can go into one PR; the second is where the review effort is.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)