#15 - Negatives converted to positives in the app, from their RAW files #26

Merged
eliott merged 14 commits from feat/15-negative-conversion into main 2026-11-18 23:45:42 +01:00
Owner

This is a beta of these features. How they work underneath is done and gives good results; where things are placed in the Convert tab and how they are used can still change.

The app now turns the RAW file of a negative into a positive, in a Convert tab of its own and with rollscan convert. RAW files are added or dropped on the window, the film's base is clicked, the frame is drawn, and the positive is saved as a 16-bit TIFF. It works for colour and for black-and-white film, and needs no camera and no Arduino.

The film's base gives the white balance of the negative, each value is inverted by its reciprocal, and each channel is stretched between its own black and white points, measured in the frame. The frame and the base drawn on the picture can be moved and resized afterwards.

This branch sits on top of #24 (feat/23-ui-ux-fixes): merging it brings that pull request's four commits to main with it.

Part of #15

How it works

  • The steps and their reasons are in docs/negative-conversion.md; the design is in docs/development/2026-11-18-negative-conversion-design.md.
  • The levels are measured on the picture shrunk until its long side is 2000 pixels at most, which is the copy shown on the screen: what is saved gets the levels of what was shown, on any camera, and grain does not set them.
  • The film holder is recognised and left out of the levels; bare base in the frame area is not, so the frame has to be drawn inside the picture.
  • No colour profile of the camera is applied: greys are grey, colours are less saturated than they were.
  • The clipping defaults (0.5 % of the frame for the shadows, 0.001 % for the highlights) and the constant 1.04 were set by measuring conversions of real negatives shot with a Fujifilm X-T5.

Tested

  • cargo test: 287 passed.
  • Six black-and-white negatives (Foma 400, Fujifilm X-T5) converted with rollscan convert and compared with reference positives of the same files: between -1.4 and +1.8 steps of 255 on average, black points within 0.004 and white points within about 0.02 of the reference ones.
  • One colour negative (CineStill 800T, X-T5) converted and looked at.
  • The Convert tab used by the maintainer in the AppImage on Linux, with files from the X-T5.

Not tested

  • Any camera other than the X-T5: the constants may suit another one less well.
  • Windows and macOS.
  • Moving and resizing the frame and the base were not driven by an automated test of the page.

Changes in behaviour

  • rollscan convert and the Convert tab are new: nothing that existed works differently.
**This is a beta of these features.** How they work underneath is done and gives good results; where things are placed in the Convert tab and how they are used can still change. The app now turns the RAW file of a negative into a positive, in a Convert tab of its own and with `rollscan convert`. RAW files are added or dropped on the window, the film's base is clicked, the frame is drawn, and the positive is saved as a 16-bit TIFF. It works for colour and for black-and-white film, and needs no camera and no Arduino. The film's base gives the white balance of the negative, each value is inverted by its reciprocal, and each channel is stretched between its own black and white points, measured in the frame. The frame and the base drawn on the picture can be moved and resized afterwards. **This branch sits on top of #24** (`feat/23-ui-ux-fixes`): merging it brings that pull request's four commits to `main` with it. Part of #15 ## How it works - The steps and their reasons are in `docs/negative-conversion.md`; the design is in `docs/development/2026-11-18-negative-conversion-design.md`. - The levels are measured on the picture shrunk until its long side is 2000 pixels at most, which is the copy shown on the screen: what is saved gets the levels of what was shown, on any camera, and grain does not set them. - The film holder is recognised and left out of the levels; bare base in the frame area is not, so the frame has to be drawn inside the picture. - No colour profile of the camera is applied: greys are grey, colours are less saturated than they were. - The clipping defaults (0.5 % of the frame for the shadows, 0.001 % for the highlights) and the constant 1.04 were set by measuring conversions of real negatives shot with a Fujifilm X-T5. ## Tested - `cargo test`: 287 passed. - Six black-and-white negatives (Foma 400, Fujifilm X-T5) converted with `rollscan convert` and compared with reference positives of the same files: between -1.4 and +1.8 steps of 255 on average, black points within 0.004 and white points within about 0.02 of the reference ones. - One colour negative (CineStill 800T, X-T5) converted and looked at. - The Convert tab used by the maintainer in the AppImage on Linux, with files from the X-T5. ## Not tested - Any camera other than the X-T5: the constants may suit another one less well. - Windows and macOS. - Moving and resizing the frame and the base were not driven by an automated test of the page. ## Changes in behaviour - `rollscan convert` and the Convert tab are new: nothing that existed works differently.
- the window no longer scrolls: each panel scrolls on its own
- the arrows move the film by a length picked from 0.25 to 10 mm
- the picture zooms with the wheel, the buttons or + and -, and drags
- the keyboard drives the film, the zoom and the scan; ? lists the keys
- a file name can be given apart from the roll's name
- Check framing is hidden when the camera has a live view
- neutral greys instead of warm stone, with the accent on what is selected
- errors show as toasts, questions in the app's own dialog
- the empty viewer says what is missing, under a strip of film
rollscan convert reads a RAW file as the sensor measured it, divides it by
the film's base, goes to densities, stretches each channel between its own
percentiles, renders the result as a print or as the scene's light, and
saves a 16-bit sRGB TIFF. The method and what it leaves out are in
docs/negative-conversion.md.

RAW files are read with rawler (LGPL-2.1).
A Convert view beside the scan: RAW files are handed to the app, each shows
as a positive, and the film's base and the frame are drawn on the picture.
The base is measured once and serves for every negative in the list. The
positives are saved as 16-bit TIFF files where the scans go.
The window receives the files, not the page: it now tells the page where
they are, and the app reads them there, without a copy. Dropping files
opens the Convert view.
Adding or picking a negative no longer converts it: it shows as shot, the
film's base and the frame are drawn on it, and Convert turns it into a
positive. The base drawn on a negative still shown as shot is measured at
once, so that it serves for the others.
A click on bare film measures a small square around it: a few thousand
pixels, whose median neither grain nor dust moves.
The density and the print curve are replaced: the film's base gives the white
balance, the balanced value is inverted by its reciprocal, encoded with a square
root, and each channel is stretched between its own black and white points,
measured on the frame shrunk four times.

The rendering choice is gone and the clipping is set apart for the shadows and
the highlights, in the app and in rollscan convert (--clip-shadows,
--clip-highlights; --black and --white are levels from 0 to 1).
The levels were measured on the picture shrunk four times, which is the size of
the copy looked at only for sensors about 8000 pixels wide: on others the
positive shown and the one saved did not get the same black and white points.
They are now measured on the picture shrunk until its long side is 2000 pixels
at most, which is that copy, on blocks that fall at the same places in both.

The frame drawn is rounded inward on the small copy, so that a pixel half on
the film holder stays out of it. A black or white point given by hand is no
longer moved when the frame is flat: the measured one is.
A rectangle drawn roughly is put right afterwards: dragging inside it moves it,
dragging an edge or a corner resizes it, and the pointer shows which. Starting
outside it draws another, as before.
eliott merged commit 9be64ea757 into main 2026-11-18 23:45:42 +01:00
eliott deleted branch feat/15-negative-conversion 2026-11-18 23:45:42 +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!26
No description provided.