Skip to content

fix: use each triplet's own exposures in batch export (#382)#398

Merged
marcinz606 merged 1 commit into
mainfrom
fix/trichrome-export
Jul 4, 2026
Merged

fix: use each triplet's own exposures in batch export (#382)#398
marcinz606 merged 1 commit into
mainfrom
fix/trichrome-export

Conversation

@marcinz606

Copy link
Copy Markdown
Owner

Fixes #382.

Problem

Bulk-exporting RGB-scan (trichrome) triplets fails on most frames with Export pipeline failed: b'Input/output error' — only a couple export. Individual export works.

b'Input/output error' is rawpy/LibRaw on a nonexistent path (reproduced: rawpy.imread(missing) raises exactly this).

Root cause

  • Individual export works: select_file freshly re-injects each triplet's green/blue exposure paths from the discovery-verified asset dict into state.config.
  • Batch export built each frame's params from the saved DB config and never re-injected the asset's own green/blue. A frame whose DB config held a stale/missing exposure path (prior session, RGB-mode regroup, or session restore) decoded a file that wasn't there → LibRaw EIO → that frame errored and was skipped.

Fix

  1. resolve_asset_rgbscan(params, asset) — pure helper in session.py: re-injects a frame's own green/blue/align from the asset dict; resets rgbscan for non-triplet frames so a batch frame never inherits the currently-open frame's config.
  2. _batch_params_for(f) — routes all three batch task-builders (request_batch_export, request_preset_batch_export, request_contact_sheet) through it, so batch uses the same authoritative source as single-file export.
  3. Guard in _load_source_f32: a genuinely-missing exposure now raises a clear FileNotFoundError: RGB-scan green exposure not found: <path> instead of cryptic LibRaw bytes. The batch worker already continues per-file.

Tests

  • New unit tests (test_rgbscan.py): inject-from-asset overrides a stale config, align honored, reset-when-not-triplet.
  • Updated one existing test that relied on fake paths (now real temp files).
  • make all green: lint + type clean, 1109 passed.

Manual repro (real triplet folder + "Export all") still recommended before release.

Batch export built per-frame params from the saved DB config and never
re-injected the frame's own RGB-scan green/blue exposures from the asset
dict. A frame whose DB config held a stale/missing exposure path (prior
session, RGB-mode regroup, or session restore) decoded a nonexistent file,
which rawpy surfaces as b'Input/output error' — so "export all" failed on
most triplet frames while individual export (which re-injects via
select_file) worked.

Route all three batch task-builders through resolve_asset_rgbscan so each
frame uses its own discovery-verified exposures, matching single-file
export. Guard _load_source_f32 to raise a clear FileNotFoundError when a
triplet exposure is genuinely missing instead of the cryptic LibRaw bytes.
@marcinz606 marcinz606 merged commit 1f099ea into main Jul 4, 2026
1 check passed
jboneng added a commit to jboneng/NegPy that referenced this pull request Jul 4, 2026
…cted

Integrate RGB-scan batch params (marcinz606#398) into the preset export refactor while keeping selected-frame main button and excluded-frame filtering.

Co-authored-by: Cursor <cursoragent@cursor.com>
@marcinz606 marcinz606 deleted the fix/trichrome-export branch July 5, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk exporting fails: Worker failure: b'Input/output error'

1 participant