Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryAdds thumbnails from the JPEG previews stored inside supported camera RAW files.
No new actionable issues found. The earlier failure-cache finding is addressed. Reviews (3) · Last reviewed commit: "Let a RAW thumbnailer installed later dr..." · Reviewed by Greptile |
dhh
force-pushed
the
raw-thumbnails-embedded
branch
from
November 18, 2026 15:06
1881583 to
82ff430
Compare
This was referenced Nov 18, 2026
A CR2, NEF, NRW, ARW, SR2, DNG or PEF showed a blank tile unless a RAW thumbnailer was installed. The camera stores a finished JPEG in each, and a bounded reader of the TIFF directories now finds the largest one. An installed thumbnailer still answers first.
One orientation was kept for the whole file, so a preview whose directory names a turn of its own was turned by IFD0's instead. Each embedded JPEG now carries its directory's orientation, and takes the file's only when its directory names none.
A JPEG may put 0xFF fill bytes ahead of a marker, and the Exif segment of one that did was missed, so an upright preview got the RAW's turn. And the walk followed IFD0's next pointer into IFD1, the Exif thumbnail's directory, whose orientation then passed for the picture's. Only IFD0's own Orientation is read now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A preview is no longer ranked when its frame header claims more than 250 million pixels, more than any camera's; a few KiB claiming 57000 by 56000 otherwise ranked first and cost a 270 MB decode that failed, up to sixteen times per file. The header budget now caps the number of reads as well as their bytes: each read is its own system call, a round trip on a network mount, and crafted directories reached some 60,000 tiny reads within the byte budget. The embedded JPEG is read into a buffer with room for the Exif segment, so putting the segment in front no longer copies up to 64 MiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Files that failed only because of what's fixed here (a name holding a %, a helper that never started, a camera RAW Folio couldn't read) kept their failure markers, and those hold a file back before any of the fixes are reached, so they stayed blank until the file changed. The markers' round goes to 3, so each is tried once more. The same change is in each of the thumbnail fixes, so they merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A camera RAW whose embedded JPEG couldn't be found was remembered as failed, so installing a RAW thumbnailer afterwards changed nothing until the file did. Finding no preview inside isn't remembered now; the reader is bounded, so looking again costs little. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dhh
force-pushed
the
raw-thumbnails-embedded
branch
from
November 18, 2026 16:27
82ff430 to
077bce2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #66 by @thisisgm, with the review fixes from that branch.
Most camera RAW files were a blank tile unless a RAW thumbnailer was installed, or went through LibRaw by way of Qt's raw plugin, which decodes the whole sensor (and threw on CR2s, #164). The camera stores a finished JPEG inside each file, and a bounded reader of the TIFF directories now finds the largest one in a CR2, NEF, NRW, ARW, SR2, DNG or PEF, so nothing is decoded from the sensor data and nothing is linked in. A preview that does not decode is passed over for the next largest, all within one read limit. A preview is turned by the orientation its own directory names (IFD0, past any fill bytes before the JPEG's marker), and by the file's when it names none. An installed thumbnailer still answers first, and a broken file is refused rather than guessed at: offsets, counts and lengths are checked against named limits, a preview claiming more than 250 million pixels is skipped before decoding, and the number of header reads is capped as well as their bytes. CR3, RAF, ORF, RW2 and SRW keep their JPEG in other containers and still show an icon.
Finding no preview inside isn't remembered as a failure, so a RAW thumbnailer installed later still draws the file. The failure markers' round goes to 3, so RAW files an older Folio gave up on are tried once more; the same change is in #175 and #176, so they merge in any order.
One RAW file from each of twelve cameras, main above and this branch below (from #66):
🤖 Generated with Claude Code