cnefx-cli
v0.2.0
Published
Native Nikon pixel-shift synthesis to NEFX.
Readme
cNEFX
Merge Nikon pixel-shift captures into NEFX files on Linux, macOS and Windows. cNEFX accepts complete 4, 8, 16 or 32-frame sequences from the Z8, Zf, Z6III and Z5II. It runs natively, with no Nikon software or Python runtime required.
Experimental: validation against authentic captures, NX Studio references and Lightroom Classic is partial.
Install
Install with mise (recommended):
mise use -g github:ChrAlpha/cNEFX@latest
cnefx merge --helpOr run without adding cNEFX to your global configuration:
mise x github:ChrAlpha/cNEFX@latest -- cnefx merge --helpFor Node.js users, run with pnx:
pnx cnefx-cli merge --helpOr install globally with pnpm:
pnpm add -g cnefx-cliUpdate with mise upgrade github:ChrAlpha/cNEFX or pnpm update -g cnefx-cli.
You can also build from source or download native archives
from Releases.
Builds cover Linux x86_64/ARM64, macOS Apple silicon and Windows x86_64.
Check the accompanying .sha256 file, extract the archive, and add its bin
directory to PATH. Builds are unsigned and not notarized; older-system
compatibility is not established.
Merge pixel-shift captures
Use lossless-compressed, 14-bit FX NEF files. Pass a card folder, files or a file-name pattern; no other option is needed:
cnefx merge /path/to/DCIM/100NZ_8cNEFX finds the pixel-shift sequences, as NX Studio does, and writes each one
beside its first capture, e.g. SGL_6243_merged.NEFX. Other photos are skipped.
With AE bracketing every exposure is its own sequence and output. Running the
same command again only merges what is missing, so an interrupted or partly
failed run can simply be repeated; existing files are never replaced.
Use --output FILE.nefx for a single sequence or --output-directory DIR to
publish all outputs with a manifest.json together. HE/HE* is unsupported; HLG,
other image areas and untested firmware/settings remain unvalidated.
Output modes
--outputs N sets the outputs per sequence and defaults to 1. Several outputs
are named NAME_merged_01.NEFX onward; --output accepts only one.
| Captures | Allowed outputs | Dimensions per output, relative to the source crop | | --- | --- | --- | | 4 | 1 | Original width and height | | 8 | 1, 2 | Original width and height | | 16 | 1, 4 | 2x width and height for one output; original for four | | 32 | 1, 2, 4, 8 | 2x width and height for one or two outputs; original for four or eight |
Options
--jobs N: set the worker limit (1-256; default: all cores). Use--jobs 1for lower memory use.--chromatic-aberration-correction: enable correction when supported by the capture metadata; disabled by default.--json: write a structured report to stdout for scripts.cnefx merge --help: show all options.
Build from source
Requires a C++20 compiler and CMake 3.21+. The build downloads and statically links a pinned LibRaw release.
git clone https://github.com/ChrAlpha/cNEFX.git
cd cNEFX
cmake --preset release
cmake --build --preset release
./build/release/cnefx merge --helpWith Visual Studio, the executable is build/release/Release/cnefx.exe.
Use the executable's full path or add its directory to PATH for the merge
examples above.
Development
See AGENTS.md for the
source map, C++ API notes, build checks, packaging and contribution guidelines.
Project scope
tracks supported behavior and remaining validation gaps. The former Python
implementation is available at the
v0.0.1 tag.
License
MIT. Distributions also include LibRaw's third-party license files.
Acknowledgements
- Nikon NX Studio, for the reference NEFX outputs used in format research.
- XinmiaoZhao's NikonFirmwarePatch / z8pixelshift, for its pixel-shift reconstruction research and arithmetic reference.
