#54 - Colour negatives come out grey in their mid-tones, keep their densest tones, and get more controls #55

Merged
eliott merged 7 commits from feat/54-colour-negatives into main 2026-11-22 16:23:21 +01:00
Owner

Colour negatives no longer come out with a cast in their mid-tones. Each colour layer of the film has its own contrast, and the conversion now brings red's and blue's to green's, so a grey comes out grey from the shadows to the highlights, not only at both ends. The densest parts of a negative are no longer cut before the black and white points are set, and how brightly the negative was shot no longer changes the result. On top of that, the positive gets more controls: the colour of the shadows and of the highlights, contrast, exposure, a grey picker, and curves whose end points also clip the shadows and the highlights. A negative can be turned a quarter at a time, and negatives ticked in the list are converted and saved together.

No camera colour profile, matrix or ICC is used, as asked on the issue: point 6 of #54 is left out on purpose.

Closes #54

How it works

  • Every value is divided by the film's base (t = v / base), then read as if the base were 0.124 in green, what it read on the scans the constants were calibrated on. A scan two stops darker gives the same positive, bit for bit on the test wedge.
  • Layers: t' = t ^ (1 / layer). layer is the slope of the channel's density against green's, a total least squares line fitted across the frame on the same small copy the levels use. It is left at 1 on a flat frame and held between 0.5 and 2. It can also be typed, kept from one negative for the whole list, or solved from greys picked on the negative (the base counts as a grey; a pick on bare film is refused).
  • The reciprocal and the square-root encoding are unchanged, but lin is no longer held at 1. The histogram for the levels now runs up to an encoded 16, and values past the white point are held at the very end, after the adjustments.
  • New adjustments, in order: shadow and highlight colour (each channel's black or white point moved its own way), the existing warmth and tint (the grey picker solves them exactly), saturation, contrast (an S-curve through 18 % grey), brightness, exposure (a gain on light, ±2 stops), then curves. The curves are monotone cubics, one per channel then one for all, folded into the per-channel output tables, so they cost nothing per pixel.
  • The holder test still uses the sensor's values as they are, so it behaves as before.
  • New API: POST /api/negatives/{id}/layers (greys to layers) and POST /api/negatives/{id}/neutral (area to warmth and tint). Recipes take layers and rotate, and adjust takes the new fields and curves.
  • Curves are flat before their first point and after their last, so their ends move sideways in the editor; no end is added for you, on the command line either.
  • Rotation: quarter turns per negative. The page turns the canvas itself and turns the pointer back into the RAW file's pixels, so drawing still works on a turned picture. The saved TIFF's pixels are turned after the crop, in the same pass; rollscan convert --rotate 90|180|270.
  • Frames: the first frame drawn serves every negative; drawing or moving one after that gives the negative shown a frame of its own, used for its levels and its crop. Forget the frame takes it away, Use this frame for the others shares it.
  • Selection: checkboxes in the list and Select all. With negatives ticked, Convert turns them all into positives (or all back) and Save all becomes Save N selected; with none ticked, both act as before.

Tested

  • cargo test: 320 passed. New tests check that a colour wedge with three layer contrasts comes out grey at every step, and that the same negative shot 2 stops darker gives the same positive. They also cover: dense steps kept apart with no warning, layers measured, given and solved from greys, the grey picker making its area grey, exposure, contrast, shadow and highlight colour, curves (per channel, master, ignored channels in black and white, ends moved inward clipping, points held), quarter turns with and without the crop, the dark-scan warning, the darkroom pickers and rotation, the server endpoints and the CLI options. cargo clippy --all-targets is clean, and pnpm build in site/ passes.
  • RAW files from a Fujifilm X-T5, converted with rollscan convert:
    • roll_01, 120 colour negative, the frame of the issue: layers measured 0.81 and 1.33, mean light B/G 0.91, R/G 0.94 (was 1.86 and 0.65), no warning (was "brightest tones lost" in green and blue). 40 MP in 1.1 s.
    • roll_02, 35 mm black and white from the calibration roll: layers measured 1.02 and 1.01.
  • The app on Linux, in a headless WebKit: adding the RAW, drawing the base and frame, converting, layers measured and kept, greys picked (and one on bare film refused), the grey picker, the contrast presets, exposure typed, curves added, dragged and per channel, the curve's ends dragged sideways, a negative turned right with the frame drawn on the turned picture and saved turned (4078 × 4113), two negatives selected, converted and saved together, and Save.

Not tested

  • The real scanner, and the app's own window: the page was driven in a headless browser.
  • Windows and macOS.
  • Cameras other than the X-T5.
  • Comparing the new positives with the reference conversions of the CineStill frames (the rms check proposed on #54).
  • A full roll converted with layers kept from one frame.

Changes in behaviour

  • Frames whose densest tones went past the old ceiling now keep those tones, and their white point moves up to them. They come out darker in the mid-tones than before: about 14/255 on average on frame 02 of the black-and-white calibration roll, which used to clamp in all three channels. Exposure, White point or Highlights clipped brings them back. The "brightest tones are lost" warning is gone.
  • --black and --white values printed by earlier versions are on another scale unless the base read 0.124 in green: measure them again.
  • The layers are measured on each frame by default. A frame where one colour fills the picture can be over-corrected: keep a neutral frame's layers for the whole list, or give --layers.
  • A new warning when the film's base reads under a sixteenth of the sensor's ceiling.
  • The frame is no longer one for the whole list: correcting it on one negative leaves the others as they were.
  • --curve and the per-channel curves need at least two points, ends included: 0:0,0.5:0.6,1:1.
Colour negatives no longer come out with a cast in their mid-tones. Each colour layer of the film has its own contrast, and the conversion now brings red's and blue's to green's, so a grey comes out grey from the shadows to the highlights, not only at both ends. The densest parts of a negative are no longer cut before the black and white points are set, and how brightly the negative was shot no longer changes the result. On top of that, the positive gets more controls: the colour of the shadows and of the highlights, contrast, exposure, a grey picker, and curves whose end points also clip the shadows and the highlights. A negative can be turned a quarter at a time, and negatives ticked in the list are converted and saved together. No camera colour profile, matrix or ICC is used, as asked on the issue: point 6 of #54 is left out on purpose. Closes #54 ## How it works - Every value is divided by the film's base (`t = v / base`), then read as if the base were 0.124 in green, what it read on the scans the constants were calibrated on. A scan two stops darker gives the same positive, bit for bit on the test wedge. - Layers: `t' = t ^ (1 / layer)`. `layer` is the slope of the channel's density against green's, a total least squares line fitted across the frame on the same small copy the levels use. It is left at 1 on a flat frame and held between 0.5 and 2. It can also be typed, kept from one negative for the whole list, or solved from greys picked on the negative (the base counts as a grey; a pick on bare film is refused). - The reciprocal and the square-root encoding are unchanged, but `lin` is no longer held at 1. The histogram for the levels now runs up to an encoded 16, and values past the white point are held at the very end, after the adjustments. - New adjustments, in order: shadow and highlight colour (each channel's black or white point moved its own way), the existing warmth and tint (the grey picker solves them exactly), saturation, contrast (an S-curve through 18 % grey), brightness, exposure (a gain on light, ±2 stops), then curves. The curves are monotone cubics, one per channel then one for all, folded into the per-channel output tables, so they cost nothing per pixel. - The holder test still uses the sensor's values as they are, so it behaves as before. - New API: `POST /api/negatives/{id}/layers` (greys to layers) and `POST /api/negatives/{id}/neutral` (area to warmth and tint). Recipes take `layers` and `rotate`, and `adjust` takes the new fields and `curves`. - Curves are flat before their first point and after their last, so their ends move sideways in the editor; no end is added for you, on the command line either. - Rotation: quarter turns per negative. The page turns the canvas itself and turns the pointer back into the RAW file's pixels, so drawing still works on a turned picture. The saved TIFF's pixels are turned after the crop, in the same pass; `rollscan convert --rotate 90|180|270`. - Frames: the first frame drawn serves every negative; drawing or moving one after that gives the negative shown a frame of its own, used for its levels and its crop. Forget the frame takes it away, Use this frame for the others shares it. - Selection: checkboxes in the list and Select all. With negatives ticked, Convert turns them all into positives (or all back) and Save all becomes Save N selected; with none ticked, both act as before. ## Tested - `cargo test`: 320 passed. New tests check that a colour wedge with three layer contrasts comes out grey at every step, and that the same negative shot 2 stops darker gives the same positive. They also cover: dense steps kept apart with no warning, layers measured, given and solved from greys, the grey picker making its area grey, exposure, contrast, shadow and highlight colour, curves (per channel, master, ignored channels in black and white, ends moved inward clipping, points held), quarter turns with and without the crop, the dark-scan warning, the darkroom pickers and rotation, the server endpoints and the CLI options. `cargo clippy --all-targets` is clean, and `pnpm build` in `site/` passes. - RAW files from a Fujifilm X-T5, converted with `rollscan convert`: - roll_01, 120 colour negative, the frame of the issue: layers measured 0.81 and 1.33, mean light B/G 0.91, R/G 0.94 (was 1.86 and 0.65), no warning (was "brightest tones lost" in green and blue). 40 MP in 1.1 s. - roll_02, 35 mm black and white from the calibration roll: layers measured 1.02 and 1.01. - The app on Linux, in a headless WebKit: adding the RAW, drawing the base and frame, converting, layers measured and kept, greys picked (and one on bare film refused), the grey picker, the contrast presets, exposure typed, curves added, dragged and per channel, the curve's ends dragged sideways, a negative turned right with the frame drawn on the turned picture and saved turned (4078 × 4113), two negatives selected, converted and saved together, and Save. ## Not tested - The real scanner, and the app's own window: the page was driven in a headless browser. - Windows and macOS. - Cameras other than the X-T5. - Comparing the new positives with the reference conversions of the CineStill frames (the rms check proposed on #54). - A full roll converted with layers kept from one frame. ## Changes in behaviour - Frames whose densest tones went past the old ceiling now keep those tones, and their white point moves up to them. They come out darker in the mid-tones than before: about 14/255 on average on frame 02 of the black-and-white calibration roll, which used to clamp in all three channels. Exposure, White point or Highlights clipped brings them back. The "brightest tones are lost" warning is gone. - `--black` and `--white` values printed by earlier versions are on another scale unless the base read 0.124 in green: measure them again. - The layers are measured on each frame by default. A frame where one colour fills the picture can be over-corrected: keep a neutral frame's layers for the whole list, or give `--layers`. - A new warning when the film's base reads under a sixteenth of the sensor's ceiling. - The frame is no longer one for the whole list: correcting it on one negative leaves the others as they were. - `--curve` and the per-channel curves need at least two points, ends included: `0:0,0.5:0.6,1:1`.
- Every value is divided by the film's base and brought to the base the constants were measured at, so how brightly a negative was shot no longer changes the positive.
- Each colour layer's contrast is brought to green's: measured on the frame, typed, kept for the whole list, or solved from greys picked on the negative.
- Nothing is held at 1 before the levels: the white point lands on the frame's densest tones instead of a fixed ceiling.
- New adjustments: the colour of the shadows and of the highlights, contrast (with soft, standard and hard), exposure, a grey picker for warmth and tint, and curves for all channels and for each.
- The command line has the same: --layers, --layers-from, --grey-at, --shadow-*, --highlight-*, --contrast, --exposure, --curve*.
- A scan whose base reads under a sixteenth of the sensor's ceiling is told; the warning about tones lost past 1 is gone, as they no longer are.
- No camera colour profile or matrix is used.

Part of #54
docs: say how the colour layers, the new adjustments and the curves work
Some checks failed
app / linux (pull_request) Failing after 55s
app / windows (pull_request) Successful in 3m0s
website / build (pull_request) Successful in 40s
e8834197bc
Part of #54
- A curve is flat before its first point and after its last; ends are no longer added at (0, 0) and (1, 1).
- In the editor, the bottom-left and top-right points move both ways, each kept on its side of its neighbour.
- --curve and the per-channel ones take at least two points: give 0:0 and 1:1 for a curve that keeps black and white.

Part of #54
- Rotate, under Crop to the frame: Left and Right turn the negative shown. Each negative keeps its own; what is drawn on it turns with it, and drawing on the turned picture lands in the right place.
- The saved TIFF's pixels are turned, after the crop and in the same pass, so every program shows it upright.
- `rollscan convert --rotate 90|180|270`.

Part of #54
feat(app): negatives ticked in the list are converted and saved together
Some checks failed
app / linux (pull_request) Failing after 44s
app / windows (pull_request) Successful in 1m12s
website / build (pull_request) Has been cancelled
7cd3906f70
- Each negative in the list has a checkbox, and Select all ticks them all.
- With negatives ticked, Convert turns them all into positives (or all back), showing the first when the one shown is not among them, and Save all saves only them.
- With nothing ticked, Convert and Save act as before; the adjustments stay those of the negative shown.

Part of #54
eliott changed title from WIP: #54 - Colour negatives come out grey in their mid-tones, keep their densest tones, and get more controls to #54 - Colour negatives come out grey in their mid-tones, keep their densest tones, and get more controls 2026-11-22 16:09:43 +01:00
chore(app): format the conversion code as cargo fmt does
Some checks failed
app / linux (pull_request) Successful in 5m42s
app / windows (pull_request) Has been cancelled
website / build (pull_request) Has been cancelled
50d0d3743a
Part of #54
feat(app): each negative can have a frame of its own
All checks were successful
app / linux (pull_request) Successful in 2m22s
app / windows (pull_request) Successful in 1m4s
website / build (pull_request) Successful in 40s
9a9b1e2516
- The first frame drawn still serves every negative. Drawing or moving one after that changes it on the negative shown only, so correcting it on one picture no longer moves it on the others.
- Forget the frame takes a negative's own frame away (the shared one serves it again); Use this frame for the others makes it the frame of every negative without one of its own.
- Each negative's levels are measured, and its saved file cropped, in its own frame.

Part of #54
eliott merged commit 8f91c74285 into main 2026-11-22 16:23:21 +01:00
eliott deleted branch feat/54-colour-negatives 2026-11-22 16:23:21 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
RollNote/rollscan!55
No description provided.