Skip to content

Usage and Workflow

botrx555 edited this page Jul 14, 2026 · 3 revisions

Usage and Workflow

Basic invocation

python3 m8raw2dng2.py [options] [files-or-folders ...]
  • -i <path> input file or folder (default: current folder)
  • -o <path> output folder (default: alongside the input)

Bare conversion is byte-identical to the original tool (bar the estimated FNumber); every refinement is opt-in. Full switch list in Flags Reference.

Prefer no Python? The standalone Mac/Windows app on each release runs this same workflow through the GUI; see Installation to get and unlock it.

Launchers

Two convenience launchers ship with the tool:

  • m8raw2dng2_run.bat (Windows)
  • m8raw2dng2_run.command (macOS - may need chmod +x and a Gatekeeper right-click Open the first time; see Installation)

Open either in a text editor and set the variables near the top:

  • INPUT - the RAW folder (or a single .RAW / .DNG)
  • OUTPUT - leave blank to write DNGs beside the input
  • FLAGS - the option string (default -v -p -b -s --no-crop --cfa RGGB); see Flags Reference
  • PYTHON - python / python3, or a full path if Python is not on PATH

Keep the launcher beside m8raw2dng2.py (and your lensdb.ini / sensdb.ini). Copy it once per recipe you use often - e.g. m8_convert, m8_darkfield, m8_calibrate - each with its own FLAGS.

The full workflow

A complete setup is three one-time calibrations plus the everyday convert. You can skip straight to converting - the calibrations are refinements.

Step 1 - sensor darkfield (-sd), once per body

Build a per-body darkfield so -s can flatten fixed-pattern column structure. Shoot several dark frames at base ISO with the lens cap on, then:

python3 m8raw2dng2.py -sd -i ./darkframes

-sd accepts a whole folder of dark frames and auto-selects the clean, fast, low-ISO ones, averaging them for a less noisy darkfield. It writes LevelCorrection values into sensdb.ini keyed by body serial. Add --auto-lines to also detect defect columns and record them as Line entries. See Databases and The Math.

Fixing a vertical defect line (-st / Line)

To find bad columns, paint the configured/auto-detected ones white and inspect:

python3 m8raw2dng2.py -st -i ./frame.RAW

Detected columns are stored as Line entries in sensdb.ini and repaired by neighbour interpolation on every -s conversion.

When you read a bad column's position from a pixel viewer and enter it as a Line by hand, add 2 to every x and y: the RAW carries a 2-px border that the cropped DNG drops (RAW 3968x2646, DNG 3964x2642), so RAW coordinates sit 2 px off the DNG coordinates you measured.

--auto-repair re-detects columns per image as well, but use it on dark / calibration frames only - on a lit photo it mistakes scene structure for defects and smears real columns. Normal shots need only plain -s, which repairs the stored Line entries regardless.

Step 2 - lens aperture calibration (--calibrate-fnumber), once per (body, lens)

For an un-coded lens the M8 records no aperture. Calibrate once so every later conversion recovers the true aperture from the meters:

python3 m8raw2dng2.py --calibrate-fnumber 2.8,4,5.6,8,11 -l 000110 f1.RAW f2.RAW f3.RAW f4.RAW f5.RAW

Shoot anything (auto exposure is fine) at the listed apertures, in filename order. The derived MeterOffset (and cross-check ImageCalib) is stored in sensdb.ini under the body serial. 5-10 frames, once per (body, lens). See The Math.

Step 3 - convert

Everyday conversion with lens EXIF, sensor fixes, preview, recursion and a self-check:

python3 m8raw2dng2.py -v -p -l 000110 -s -R --verify -i ./in -o ./out

Per-frame dark subtraction (.BIA)

If a .BIA sidecar sits next to a .RAW (same stem), it is read as another raw frame, subtracted from the CFA, clamped, and BlackLevel is forced to 0. This is automatic whenever the sidecar is present. It corrects the per-exposure dark pedestal on long exposures. See The Math.

Inspecting without converting

python3 m8raw2dng2.py --probe ./frame.RAW      # report geometry, write nothing
python3 m8raw2dng2.py --dry-run -i ./in        # list what would be done

Common examples

# verbose, embed previews, one folder
python3 m8raw2dng2.py -v -p -i ./in -o ./out

# byte-faithful single file with an exact aperture
python3 m8raw2dng2.py -v -A 2.0 -i ./frame.RAW -o ./out

# standard-DNG layout so macOS Finder shows thumbnails
python3 m8raw2dng2.py -p --legacy-preview -i ./in -o ./out

Clone this wiki locally