Land camera-native raw profiles, real ICC soft proofing and 16-bit proxies.

Camera profiles, proofing tables and the half-float sidecar all have to agree
with the pixels the editor actually grades, so they land together with the
preset filter menu that was unusable while thumbnails streamed in.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 03:59:55 +00:00
parent 6dfddffc14
commit 0c113e7a91
53 changed files with 9217 additions and 476 deletions
+121 -26
View File
@@ -62,16 +62,22 @@ changing the current filters.
**Develop.** A WebGL2 multi-pass pipeline (`src/gl/renderer.ts`), per photo,
non-destructive:
- white balance, exposure, contrast, highlights/shadows/whites/blacks
- texture, clarity, dehaze, vibrance, saturation, black & white mix
- RGB and per-channel tone curves
- 8-band HSL colour mixer, split toning / colour grading
- white balance as a relative Temp/Tint offset or an absolute Kelvin value with a
5500 K daylight reference, exposure, contrast, and hue-preserving
highlights/shadows/whites/blacks
- per-channel highlight recovery, texture, clarity, per-pixel dehaze, vibrance,
saturation, black & white mix
- input levels (black point, white point, midtone gamma), RGB and per-channel tone
curves
- 8-band HSL colour mixer evaluated in OkLCh (hue and chroma changes keep their
perceived lightness), split toning / colour grading
- sharpening, luminance noise reduction
- vignette, grain
- crop with nine aspect ratios, straighten, 90° rotation, flips
- local adjustments (up to four layers): brush, linear gradient and radial masks with
feather, invert, luminance/hue/saturation ranges, and per-layer exposure, contrast,
highlights, shadows, temperature, tint and saturation. Masks follow crops, zoom,
- local adjustments (up to eight layers): brush, linear gradient and radial masks
with feather, invert, luminance/hue/saturation ranges, and per-layer exposure,
contrast, highlights, shadows, whites, blacks, temperature, tint, saturation,
vibrance, hue, texture, clarity, dehaze and sharpening. Masks follow crops, zoom,
healing and lens correction; Copy mask / Paste mask move one layer between photos
- full Lensfun profiles: distortion, transverse chromatic aberration and vignetting
from the official database, with manual lens search, "Match EXIF lens"
@@ -87,8 +93,8 @@ non-destructive:
- histogram, built-in and saved presets, history with undo/redo, selective
copy/paste and batch sync, named snapshots, virtual copies, before/after (**\**)
- on-device auto subject, sky and background masks (no model download), an
ISO/camera-aware noise starting point, edge-aware lens-softness compensation, and an
approximate paper soft-proof preview
ISO/camera-aware noise starting point, edge-aware lens-softness compensation, and soft
proofing through a loaded printer ICC profile (or a paper simulation when none is)
- HDR merge with alignment, horizontal panorama stitching and focus stacking; each
result is added to the catalog as a new editable photo
- browser print layouts (A4, Letter, 5×7) rendered through the develop pipeline
@@ -97,7 +103,9 @@ non-destructive:
Clients need no account: they see that event's live photos, heart favourites, leave
per-photo comments, mark a photo approved or needing changes, and download proofs
individually or as one ZIP. Feedback shows up on the library grid and in the "Client
picks", "Approved" and "Changes" filters. Revoking a link drops its picks and feedback.
picks", "Approved" and "Changes" filters. Each link can carry a password, a closing
date, a download cap or downloads switched off, and a watermark that is rendered into
newly published proofs. Revoking a link drops its picks, feedback and access settings.
**Team accounts.** The first signup becomes the admin. Admins create single-use invite
links (`/join/<token>`) with an optional email lock and 1–30 day expiry, copy them from
@@ -111,6 +119,22 @@ quota, schedule a 24-hour cleanup of the oldest content, send a warning immediat
cancel a scheduled cleanup. Cleanups stop at a target percentage of the quota instead
of deleting the whole original plan.
**Tethering.** Watch a folder on the server for an event: the editor polls it, pulls
each new JPEG/TIFF/WebP/raw, imports it through the normal path (raw decode, metadata,
cloud mirroring) and only then removes the file from the folder. Point a capture app or
a transfer folder at `<data>/tether/<event>`; nothing is lost if the tab closes.
**Cull assist.** Run a focus and duplicate pass over the selection from the command
palette. Every frame is scored from its own thumbnail with a Laplacian variance, and
near-duplicates are grouped by 64-bit difference hash, so the sharpest frame of a
burst can be kept and the alternatives flagged in one action. Nothing is rated or
rejected without confirmation.
**Sidecars.** Export the selected photos' develop settings as Lightroom-style `.xmp`
sidecars (crs: attributes plus a private payload for the rest of the grade) and import
a sidecar back onto a photo. Importing keeps the crop, masks and lens profile for every
field the file does not mention.
**Catalog workflow.** Editable title, caption, creator, copyright and keyword chips
with a keyword library and reusable metadata presets. Save the current filters and sort
order as a smart collection. Virtual copies share the master file but keep independent
@@ -118,9 +142,10 @@ edits; named snapshots preserve alternative looks.
**Export and print.** JPEG, PNG, WebP or uncompressed 16-bit TIFF; quality; resize by
long edge or percent; filename template (`{name}`, `{date}`, `{time}`, `{index}`); saved
export recipes; output sharpening; watermark; XMP metadata embedded in JPEGs; an
embedded sRGB ICC profile; batch export as one ZIP or separate files. Full-resolution
export runs through the same renderer as the screen preview.
export recipes; output sharpening; watermark; XMP metadata embedded in JPEGs; sRGB,
Display P3 or Adobe RGB output with a matching generated ICC profile (JPEG/TIFF); batch
export as one ZIP or separate files. Full-resolution export runs through the same
renderer as the screen preview.
**Administration.** Users, roles, invites, catalog backup/restore, per-account quotas,
email settings and a storage relocation tool are all in one panel.
@@ -204,6 +229,7 @@ storage, while quotas are stored per account in the database.
| `LUMINARY_INVITE` | *(empty)* | Shared registration code for teammates; personal invite links work without it |
| `LUMINARY_MAX_UPLOAD` | `314572800` (300 MB) | Largest accepted upload, in bytes |
| `LUMINARY_RAW_EDGE` | `6000` | Long edge of the editable JPEG proxy made from a raw |
| `LUMINARY_16BIT` | `1` | Also keep the decoded samples as a 16-bit PNG beside the raw proxy; `0` saves the disk and download it costs, at the price of grading an 8-bit source |
| `LUMINARY_RAW_WORKERS` | `min(4, cores−1)` | Concurrent LibRaw decoders; each holds a worker and a few hundred MB |
| `LUMINARY_RAW_IDLE_MS` | `90000` | Idle decoders are disposed after this to release memory |
| `LUMINARY_DENOISE_WORKERS` | `min(4, cores−1)` | Concurrent detail-denoise jobs (read directly from the environment) |
@@ -427,9 +453,14 @@ Data directory
| `src/lib/import.ts` | File ingest, EXIF read, preview/thumb creation, upload scheduling |
| `src/lib/export.ts` | Renderer-driven export, recipes, watermark, filenames, ZIP |
| `src/lib/tiff.ts`, `icc.ts` | Dependency-free 16-bit TIFF writer and sRGB profile |
| `src/lib/preview16.ts` | 16-bit raw-proxy PNG parser, camera matrix and half-float conversion for the RGBA16F source texture |
| `src/lib/softProof.ts` | ICC parsing (lut8/lut16/mAB), printer A2B/B2A round trip and the 3D proof cube |
| `src/lib/dcp.ts` | DCP tag reader and the camera-to-sRGB matrix recipe |
| `src/lib/lensfun.ts`, `lensNames.ts`, `lensDefaults.ts` | Lensfun client, EXIF matching, saved defaults |
| `src/lib/merge.ts` | HDR / panorama / focus-stack composition |
| `src/lib/autoMask.ts`, `noiseProfile.ts` | On-device masks and ISO-aware noise starting points |
| `src/lib/xmp.ts` | Lightroom-compatible XMP sidecar reader/writer |
| `src/lib/cull.ts` | Focus scoring and duplicate hashing for cull assist |
| `src/lib/curves.ts`, `whiteBalance.ts`, `clipPreview.ts`, `presets.ts` | Curve sampling, WB maths, clipping display, presets |
| `docs/user-guide/` | Source of the in-app user guide (`guide.html`), also shipped as PDF |
@@ -510,6 +541,12 @@ routes are public and are gated only by the share token.
| --- | --- | --- | --- |
| GET | `/api/sync` | session | Everything the workspace needs: user, events, photos, presets, proof summary |
| GET | `/api/proofs` | session | Client pick/comment/review summary for the owner's events |
| PUT | `/api/events/:id/share/settings` | owner | Password, expiry, watermark, download switch and cap for the proofing link |
| GET | `/api/galleries/:token/status` | public | Whether the link is locked, its expiry and whether downloads are allowed |
| POST | `/api/galleries/:token/unlock` | public | Exchange the gallery password for a link-scoped unlock cookie |
| GET | `/api/events/:id/tether` | owner | Watch-folder path and the frames waiting in it |
| GET | `/api/events/:id/tether/file?name=` | owner | Stream one waiting frame to the editor |
| DELETE | `/api/events/:id/tether/file?name=` | owner | Remove a frame after it imported |
| PUT | `/api/presets` | session | Replace the stored preset library |
| PUT | `/api/events/:id` | owner | Upsert an event record |
| DELETE | `/api/events/:id` | owner | Delete an event (photos are handled separately) |
@@ -783,9 +820,22 @@ for album assets inline first, retries with `withoutAssets=false`, and falls bac
The browser cannot demosaic camera raw, so the server does it during upload:
1. The original file is stored byte-for-byte in `originals/` with its real extension.
2. LibRaw (`libraw-wasm`) opens it in a pooled worker with camera white balance, sRGB
output and the container's orientation, then `sharp` encodes an editable JPEG proxy
at `LUMINARY_RAW_EDGE` (6000 px by default).
2. LibRaw (`libraw-wasm`) opens it in a pooled worker with camera white balance and the
container's orientation and returns the frame **before** any output colourspace
(`outputColor: 0`). The camera-to-sRGB step is then the body's own `rgb_cam` matrix,
applied in `server/color.mjs` — the same 3×3 matrix the editor applies to the sidecar,
so changing the camera profile is a matrix swap rather than a second decode. One
white point is chosen for the frame from the matrixed pixels (99th percentile, the
clipping policy LibRaw's auto-bright targets) and baked into both outputs; LibRaw's
own auto-bright measures each output path separately and would leave the JPEG a third
of a stop away from the sidecar. `sharp` encodes the editable JPEG proxy at
`LUMINARY_RAW_EDGE` (6000 px by default). The same decode also writes a 16-bit PNG of
the camera samples beside it (`previews/<id>.p16.png`, roughly 25× the JPEG) with the
matrix in a `tEXt` chunk: the editor inflates that sidecar into an `RGBA16F` source
texture and applies `rgb_cam` in the grade shader, so the grade has 65,536 levels per
channel instead of 256. A photo without a sidecar — one imported before this existed,
a non-raw file, or a build with `LUMINARY_16BIT=0` — simply grades the JPEG, so
nothing breaks either way.
3. If LibRaw cannot open the file, the largest JPEG embedded in the container is
extracted and normalised instead. The grid marks such photos `RAW` and the Info panel
reports which engine produced the proxy, so exotic or very new cameras still import.
@@ -796,6 +846,17 @@ Formats: CR2/CR3/CRW, NEF/NRW, ARW/SRF/SR2, ORF, RW2/RWL/RAW, RAF, PEF, DNG, SRW
FFF, IIQ, X3F, ERF, K25/KDC, DCR, MOS, MRW, MEF, SRAW. Content sniffing checks the
container signature before wasting a decode attempt.
**Camera-native conversion, measured.** `rgb_cam` is applied to the sRGB-decoded camera
samples; `outputColor: 0` output is sRGB-encoded, not linear (a power curve fits it
1.8 ΔE worse). Against LibRaw's sRGB + auto-bright output on this repository's test
raws, the new proxy sits at mean ΔE 0.3–2.4 on normally exposed frames with the same
~1 % highlight clipping, and 5.5 on one very dark frame where the two auto-bright
policies disagree most — one shared white point cannot match a per-path heuristic
exactly. Applying the sidecar's matrix in the shader reproduces the server-encoded
proxy to within one 8-bit code, so the two outputs cannot drift apart. Deriving the
same matrix from a DCP `ColorMatrix1` — `inverse(rowNormalise(ColorMatrix · xyz_rgb))`
— matches LibRaw's `rgb_cam` to 2.2e-5 on a D700 NEF and 2.7e-5 on a 5D Mark II CR2.
**Parallel import.** Decoding runs in a bounded pool of LibRaw workers (default
`min(4, cores−1)`, `LUMINARY_RAW_WORKERS`), and the browser uploads several files at a
time. Each instance owns one worker thread; extra jobs queue. Idle instances are
@@ -897,7 +958,7 @@ Conventions worth knowing before changing code:
### Tests
`npm test` runs six Vitest files, all pure-logic:
`npm test` runs the pure-logic Vitest suite:
| File | Covers |
| --- | --- |
@@ -907,6 +968,9 @@ Conventions worth knowing before changing code:
| `src/lib/lensNames.test.ts` | EXIF lens-name normalisation, search variants and match scoring |
| `src/lib/lensDefaults.test.ts` | Camera + lens default selection and rejection rules |
| `src/lib/editSections.test.ts` | Selective settings copy and the ISO-aware auto-noise curve |
| `src/lib/preview16.test.ts` | 16-bit PNG proxy parsing, row flip, half-float encoding and the camera matrix chunk |
| `src/lib/dcp.test.ts` | DCP tag parsing and the camera matrix recipe against LibRaw's own values |
| `src/lib/softProof.test.ts` | ICC parsing (including counted lut16 tables), the printer round trip, gamut threshold and CMYK profiles |
There are no server integration tests; the API is exercised through the UI.
@@ -931,20 +995,51 @@ There are no server integration tests; the API is exercised through the UI.
## Limitations
- **Not a cloud service.** No hosted deployment, no tethered capture, no sync client
beyond one browser tab's whole-record push. The last writer wins per photo; it is
- **Not a cloud service.** No hosted deployment and no camera driver: tethering is a
server drop folder, not a PTP/USB connection. No sync client beyond one browser tab's
whole-record push. The last writer wins per photo; it is
designed for a handful of people, not concurrent batch workflows.
- **Per-account catalogs.** Workspaces are private to their owner; there is no shared
library between two members. Collaboration happens through client proofing links and
the admin overview.
- **Proxy-bounded raw.** Raw editing works on the demosaiced JPEG proxy (6000 px
default), not the sensor mosaic; export size is bounded by the proxy.
- **Approximate tools.** Temperature/tint are relative to the as-shot white balance.
Auto masks are an on-device saliency/colour estimate, not a segmentation model. Soft
proofing approximates paper white, black point and print gamut but does not apply a
printer ICC profile; use the browser print dialog for final ICC handling. The
- **Proxy-bounded raw.** Raw editing works on the demosaiced proxy (6000 px default),
not the sensor mosaic; export size is bounded by the proxy. Raw imports keep two
files: the JPEG proxy every browser can decode, and a 16-bit PNG sidecar of the same
pixels. The editor grades the sidecar as a half-float source texture when it is
present, which is what keeps a heavy shadow lift or a 3200 K white balance from
posterising an 8-bit source; the JPEG and everything derived from it (thumbnails,
denoise renders, proofs) stay 8-bit. A per-photo DCP profile is applied wherever
the sidecar is, i.e. the Develop canvas and exports; grid thumbnails and the compare
view grade the sRGB JPEG, which already has the body matrix baked in, so they do not
show a different camera profile. The sidecar costs about 25× the JPEG in disk, one download per photo at open time and
one extra texture in GPU memory (about 8 bytes per pixel), so `LUMINARY_16BIT=0` turns
it off for libraries that would rather have the space. Either way the 16-bit TIFF export writes 65,536
samples per channel from the `RGBA16F` render target, so its precision is only more
than the source's when the sidecar was available; it never invents detail the decode
did not produce.
- **Approximate tools.** The relative Temp/Tint sliders and the absolute Kelvin
control are display-space gains; they are not a camera-specific white-balance
matrix pair. Raw decode uses the camera's own matrix; a DCP `ColorMatrix` reproduces
it exactly (`src/lib/dcp.ts` parses the file and derives the matrix), and **Develop →
Camera profile** loads a `.dcp` per photo, storing the derived 9-number matrix in
the edit so it follows presets, snapshots and XMP. The picker is available only on
camera-native sidecars; an older sRGB proxy needs a RAW reprocess first.
Auto masks are an on-device colour-model segmentation (border histogram, Otsu split,
connected components), not a trained segmentation network, so a subject that shares
its colour with the background needs a brush pass. Soft
proofing applies a printer profile's real A2B/B2A tables when one is loaded
(**Soft proofing → Load ICC profile**), and falls back to paper white, black point and
a gamut approximation otherwise. The profile is session state rather than part of the
edit, and the print dialog still does its own colour management. Both LUT layouts are
read: v2 `lut16` with fixed 256-entry tables and the counted v4 layout that MOAB/Epson
paper profiles and Ghostscript's press profiles actually use (4096 entries, counts at
offsets 48/50). Against LittleCMS on a MOAB/Epson ET-8550 profile the cube agrees to a
mean 0.97 and p95 3 of 255 per channel. The gamut warning uses a ΔE76 round-trip
threshold of 2.5 with no endpoint rule: on the repository's photos that flags 6–8 % of
pixels, the 90th percentile round trip is 1.5 ΔE, and the neutral ramp stays clean. The
auto-noise profile is an ISO/camera heuristic over the existing sliders, not a
calibrated sensor model.
calibrated sensor model, and sharpening is multi-scale unsharp masking rather than
deconvolution.
- **Merge scope.** HDR, panorama and focus stacking are translation-aligned and aimed at
bracketed, stacked or horizontal sequences, not handheld multi-row composites. They
compose at a reduced working edge (2600 px).