Skip to content

fix(export): write the IR TIFF sidecar without the source filename in its description - #887

Merged
marcinz606 merged 1 commit into
marcinz606:mainfrom
MohammedAlkindi:fix/ir-sidecar-ascii-description
Aug 18, 2026
Merged

fix(export): write the IR TIFF sidecar without the source filename in its description#887
marcinz606 merged 1 commit into
marcinz606:mainfrom
MohammedAlkindi:fix/ir-sidecar-ascii-description

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

Closes #879

Implements the fix as scoped by @thetalkingdrum in the issue thread:

  • _write_ir_tiff now writes a fixed ASCII description (NegPy Linear Output -- infrared channel.), matching _write_tiff's fixed-string style — no filename, so tag 270 can never see non-ASCII bytes.
  • The imwrite is wrapped in try/except following the _write_tiff extratags precedent: a sidecar failure no longer kills the export.
  • On failure the partial sidecar is unlinked, so no header-only _ir stub is left looking like a real file.
  • The source_name parameter is dropped; the only caller passed os.path.basename(file_path) purely for the description.

Test: test_ir_sidecar_survives_non_ascii_source_filename copies the 4-channel LinearRaw DNG fixture to négatif_şcan.dng, exports as TIFF, and asserts the sidecar exists, is larger than a bare header, decodes as uint16, and carries no filename in its description. It fails on current main with tifffile's ValueError: TIFF strings must be 7-bit ASCII and passes with this change.

Testing: full suite on Windows 11 / Python 3.13: 4259 passed, 10 skipped, 11 deselected, 0 failed (tests/test_linear_output.py alone: 169 passed). ruff check (pinned 0.14.10) clean on both changed files.

Deliberately unchanged, per the issue discussion: the _build_xmp gate stays camera_wb-only, so the filename is not relocated into XMP.

@marcinz606
marcinz606 merged commit 30da57d into marcinz606:main Aug 18, 2026
1 check passed
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.

Linear Output IR sidecar crashes on a non-ASCII source filename

2 participants