Repository navigation
Issue #1852: Smart albums test size before the crop, bit depth and source colour - #1853
Merged
emmertex merged 1 commit intoDec 2, 2026
Conversation
…el and source colour Width and Height now follow the crop like the other size fields, and five uncropped size fields give the frame before it. Bits Per Channel, Source Color Mode and Source Color Profile come from the file, read at import and, for photos imported earlier, by a background pass with an activity row and a command (photo.readSourceColour). The value lives in the photo's metadata (catalog format 25); a file that can't be read stays unread and is tried again. Lightroom smart collections that use these import as smart albums. Manual: library/collections. Sources: own design. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes #1852
Problem
Lightroom's smart collections can test the size of the frame before and after the crop, and the file's bits per channel, colour mode and colour profile. Chromaforge's smart albums had one set of size fields, where Width and Height read the uncropped frame but Long Edge, Short Edge and Megapixels read the cropped one, and nothing kept what a file says about its colour, so those Lightroom collections imported as static ones.
Change
photo.readSourceColour(Metadata menu). It keeps its state in the photo's own metadata (meta.source_colour, catalog format 25): none means unread, a value with empty parts means read and nothing found, an unreadable file stays unread and is tried again. No side file is written.bitDepth,colorMode(2 and 32803) andcolorProfile; any other colour-mode number stays a static collection.Not in this PR: Lightroom's own bit depths for raws (15 for DNG, 16 for CR3) are not reproduced; a rule written for them imports as written and matches what this app reads. A raw is read whole once by the background pass. The catalog format moves to 25, so an older build refuses a library this one has upgraded.
Acceptance criteria
Photo::shown_size), like Long Edge, Short Edge and Megapixels. A saved rule onwidth/heightnow reads the cropped frame (decided: matches Lightroom; the What's New entry says so). — verified bywidth_and_height_follow_the_crop_and_the_uncropped_fields_do_not(lcc-catalog); seen failing with the matcher on the source sizelongEdgeCropped,shortEdgeCropped,widthCropped,heightCropped,megapixelsCroppedto the cropped fields andlongEdge,shortEdge,width,height,megapixelsto the uncropped ones; none of them falls back to a static collection any more. — verified by the importer tests and the SC-SIZE-* rows oflightroom_smart_rows.tsv(blessed, reviewed row by row); seen failing with the mapping removed (colour-mode case:criteria_map_to_their_fields_or_stay_staticand the rows test)#[serde(default)]): none means not read yet, and a value with empty parts means read and nothing found (no profile, an unreadable header). A background pass modelled onfocus_scan.rs(header reads only, one worker, an activity-stack row that can be cancelled, paced by the UI) fills the photos still unread: it starts by itself once per library opening and on demand by command, and runs on import for new photos. A file that can't be read (offline drive, file gone) stays unread and is tried again at the next opening. No sidecar record file is written to the library folder; a version inside the field lets a reader that learns more formats look again at photos recorded as nothing found. Older catalogs open (the plan confirms what an older build does with the field); never an error. — verified bytests_source_colour_scan(fill, nothing-found, unreadable stays unread and is read once back, video, older reader version read again, once-per-opening start, no undo step, older-format metadata reads as unread); seen failing with the older-version re-read turned offbitDepth == 16imports as written and matches what this app reads. — verified bysource_colour/tests.rs(engine; real JPEG, PNG, TIFF, PSD, WebP, EXR, JXL, AVIF and DNG output) andrules.rstests; seen failing with the JPEG depth off by onerules.rstests and the importer rows (only 2 and 32803 map, 5 stays static)Untagged, as Lightroom shows it (sRGB IEC61966-2.1for the test JPEG). The importer mapscolorProfile(the text operations it already maps, asanyin the test catalogs),colorModeandbitDepth; a criterion with a value this app can't express still imports as a static collection. — verified bysource_colour_fields_follow_what_the_file_said(Untagged for an empty profile) and the SC-COLORPROFILE rowunknown_data_is_none_and_no_prefix_of_any_file_panicsandcounts_and_sizes_larger_than_the_file_are_not_followed(every prefix and damaged byte of JPEG, PNG, TIFF, PSD, HEIF and EXR; oversized TIFF counts and offsets, EXR sizes and 5000 channels); seen failing with the channel cap turned into a refusaldocs/lightroom-catalog-import.md:222no longer lists "uncropped and cropped width and height") and a What's New entry are updated. — each field and mapping has its test; manual page, import page, What's New, changelog and command docs updated; the rule editor was run headless and screenshotted with the new fieldsHow it was checked
cargo xtask ci --quickandcargo test -pfor the touched crates pass on this branch, up to date withstaging(merged in, not rebased)ci --quickplus parity, layers, assets, deny, wasm and android; two known local failures,device_syncanda_cancelled_export); the branch is 18 commits behindstagingand merges cleanly (it touches the same locale files, without conflict).staging.Merging
VERSION25. If another pull request lands with it first, take one paststaging's when merging.colorModephotometric numbers, "Untagged") were observed in a test catalog.unsafe, build scripts, network access, spawned processes, deleted files, CI orxtaskgate changes: none (see Runs on CI).Runs on CI
Nothing beyond the touched crates' own tests; no workflow, build-script, packaging or dependency changes. The new tests write only to temp folders.
Checklist
get,checked_addand capped loops, and the new work is undercatch_unwind; hostile-input tests cover JPEG, PNG, TIFF, PSD, HEIF and EXRtr()and has its key incrates/ui-egui/locales/*.json(all 17 languages)docs/parity-checklist.mdare updateddocs/manual-site/; pages: library/collections)assets/ATTRIBUTION.md: none addedManual: library/collections.
Sources: own design.
🤖 Generated with Claude Code