Command-Line Reference
Options and examples for MergeRAW
Where to Find the Tool
The MergeRAW installer includes the command-line tool inside the mergeraw.lrplugin folder. It is not added to your shell's command search path. Lightroom does not need to be running to use it.
Install the free Adobe DNG Converter (download for macOS or Windows). MergeRAW depends on it to convert camera RAW files to DNG and for -demosaicIn. DNG and supported TIFF inputs can be read directly.
macOS — Intel and Apple Silicon
The installer puts mergeraw-mac64 in the system-wide Lightroom Modules folder. Open Terminal and run:
alias mergeraw='/Library/Application Support/Adobe/Lightroom/Modules/mergeraw.lrplugin/mergeraw-mac64'
mergeraw -h
Windows — Intel and AMD (x64)
The default location is the mergeraw.lrplugin folder inside your Lightroom Classic installation. Open PowerShell and run:
Set-Alias mergeraw 'C:\Program Files\Adobe\Adobe Lightroom Classic\mergeraw.lrplugin\mergeraw-winX64.exe'
mergeraw -h
On Windows ARM64, use mergeraw-winA64.exe in the same folder. If you selected a different Lightroom Classic folder during installation, adjust the path accordingly.
These aliases last for the current Terminal or PowerShell session and let you use mergeraw exactly as shown in the examples below. If you installed the plugin manually, use the executable inside your own mergeraw.lrplugin folder.
For help choosing an alignment or blend mode, see Getting Started.
MergeRAW Version 2.4.3, Written by Ryan Mack <mergeraw@mackman.net>
USAGE
mergeraw [options] -out output.dng input1 input2 ...
mergeraw [options] -out output.dng -files input_paths.txt
Put options before input paths. Quote paths containing spaces. In option
descriptions, <value> is required and [value] is optional.
Inputs: camera RAW/DNG, or unsigned 8/16-bit RGB/grayscale TIFF. TIFFs load
directly and produce a Linear DNG. Embedded RGB/gray matrix ICC profiles are
honored; untagged RGB uses sRGB, gray uses gamma 2.2. No CMYK or alpha. Keep
TIFF and camera RAW/DNG inputs in separate merges.
YOUR FIRST MERGE
These recipes use the Lightroom plugin's alignment/blend choices and Auto
demosaic. input_paths.txt lists one input path per line. For multiline
commands, \ continues a line on macOS/Linux; on Windows, join the lines
and remove \.
Long exposure on a tripod (No Alignment + Normal):
mergeraw -demosaicAuto -out long.dng -files input_paths.txt
Handheld burst to reduce noise (Auto Align + Normal):
mergeraw -demosaicAuto -alignRotate -out burst.dng -files input_paths.txt
Remove people from a busy scene (Auto Align + Median):
mergeraw -demosaicAuto -alignRotate -median -out empty.dng \
-files input_paths.txt
Low-light handheld burst (Night Align + Median):
mergeraw -demosaicAuto -alignRotate -clip -sharpGate -quietWindow \
-alignGate -clipFeather 4 -cropToCoverage -out night.dng \
-files input_paths.txt
Use matching exposures. Night Align's Median uses a clipped mean (-clip).
More recipes, including focus stacks and star trails, follow the options.
FILES AND RUNTIME
-out <file> Output DNG filename.
-files <list.txt> Read UTF-8 input paths, one per line; ignore
blank lines and # comments. Useful for large
stacks and the Windows command-line limit.
-scratchDir <dir> Existing folder for temporary frames and
converted DNGs. Default: output folder. Use a
fast local disk for large stacks.
-dngconverter <path> Path to the Adobe DNG Converter executable
(inside the .app bundle on macOS).
-threads <n> Worker count. Default: performance-core count on
Apple Silicon; otherwise half the hardware
threads.
-h, -help Show this help.
-v, -version Show version information.
BLEND AND HIGHLIGHTS
The default blend averages the inputs, matching their exposures. No
alignment runs unless requested. Input indices start at 0.
-deghost Average still areas; preserve moving subjects as
they appear in the target frame.
-median Take each pixel's median. Removes objects absent
from most frames; supports alignment.
-medianInMemory Keep median frames in RAM instead of scratch
files. Cannot be combined with alignment.
-maximum Match exposures, then keep each pixel's
brightest value (Lighten).
-minimum Match exposures, then keep each pixel's darkest
value (Darken).
-range <mode> Highlight source selection: auto (default) for
HDR means; on/shared forces shared-color weights;
perchannel selects colors independently (can
fringe at motion); off/full blends all eligible
samples. If every
source clips, average the least-exposed group.
default is an alias for auto.
-rangeThreshold <value> Source saturation threshold, 0 < value <= 1
(default 0.99). Applied before exposure gain.
-noBracketRescale Disable automatic highlight headroom for
bracketed mean merges. Recovered values above
the target's white point clip instead of being
rescaled into the output.
-target [index] Set the exposure, alignment and deghost
reference. With no index, use 0. Normally picks
the metered bracket frame or the first
darkest-EV frame; sky/night modes have their own
automatic choices.
-metaFrom <index> Copy capture identity and crop settings from
this input, independently of the target.
Defaults to the first input with sky tracking.
With -sharpGate and no -target, prefer this
frame as the target unless it is blurry.
-updateEXIF Update output ISO and exposure time for the
combined exposure (alias: -exif).
ALIGNMENT AND PIXEL SHIFT
-align Align by translation.
-alignRotate Align with sub-pixel shifts and rotation
(Lightroom Auto Align).
-alignBicubic Use sharper Catmull-Rom resampling instead of
bilinear. Slower; may overshoot at strong edges.
Experimental.
-noFocusBias With -alignRotate, disable the default
preference for aligning the in-focus parts of
each frame.
-updateAlignmentTarget Align each new frame to the accumulated result
instead of a fixed reference.
-pixelshift Assemble Nikon 4/8/16/32-shot or Fujifilm
X-Trans 20-shot sequences. The first 5 X-Trans
frames give full color at native resolution.
-noPsGridCheck Skip the pixel-shift grid check, which normally
warns if camera movement has displaced frames
from the commanded sensor positions.
HANDHELD NIGHT BURSTS
Use matching exposures and -align or -alignRotate. These controls select
frames and reject motion before averaging.
-clip Reject per-pixel outliers with a sigma-clipped
mean. Keeps moving objects out of the
background; uses temporary frame storage.
-clipSigma <k> Clipping threshold in noise sigmas for -clip and
sky stacks. Default: 2.5.
-clipDeghost [s] With -clip, preserve motion from the target
instead of the stack majority. Compare all color
planes with the target's local range plus
sensor-noise tolerance. Default: 4 sigmas.
Experimental.
-clipFeather <px> With -clip/-clipDeghost, soften and slightly
expand rejected regions for smoother
transitions. Replays stored frames; re-reads
inputs if scratch space is tight. Experimental.
-sharpGate [f] Drop frames below f times the best sharpness
score. Default: 0.75. Uses temporary storage;
automatically replaces a blurry target unless
-target was given.
-noAutoTarget Disable -sharpGate's automatic target selection;
keep the first frame unless -target is given.
-quietWindow With -sharpGate, keep the stillest stretch of
the burst and use its middle frame as target. No
effect if no suitable stretch exists.
-alignGate With -alignRotate, drop frames whose feature
alignment failed. Uses temporary frame storage.
-cropToCoverage With -clip/-sharpGate/-alignGate or sky
tracking, record a reversible crop to the
covered area. No pixels are discarded; Reset
Crop restores them in Adobe apps.
FOCUS STACKING
Shoot matching exposures. Automatic brackets keep capture order; manual
stacks use comparable lens position or distance, then capture time.
Without usable metadata, input order is preserved. The default alignment
target is the first resolved frame. Output is a Linear DNG.
-focusStack [depth|hybrid] Merge each region from the sharpest frames
(alias: -focus). Default: depth. hybrid recovers
extra fine detail with more time and memory.
Aligns neighboring frames to handle focus
breathing.
-focusScaleOnly Correct focus breathing by centered scaling only
(Lightroom Tripod). No shifts or rotation.
-focusNoAlign Skip alignment for already registered inputs.
-focusRadius <px> Sharpness window radius. Default: 24. Smaller
favors detail but adds noise/halos; larger
suppresses halos.
-focusFeather <n> Blend across this many neighboring focus slices.
Default: 1. Use 1.5 for the former wider blend.
-focusWeakPeaks Recover weak depth peaks using coarser evidence.
Default: on; -noFocusWeakPeaks disables it.
-focusDetailConfidence Reduce depth confidence at broad edges. Default:
on; -noFocusDetailConfidence disables it.
-focusTrustedBlend Select confident source pixels with a 2-pixel
feather. Experimental.
-focusDepthMapSave <file> Save a 16-bit gray depth TIFF to this path.
Black = first resolved frame; white = last.
-focusDepthMapLoad <file> Blend using an edited 8/16-bit gray depth TIFF.
Keep its full image size and sensor orientation,
and use the same inputs and resolved focus order.
-focusFeather still sets the blend width;
hybrid still adds its automatic fine detail.
SKY TRACKING
For untracked night-sky sequences with raw mosaic inputs. Star-aligned
output is a Linear DNG; one-frame outliers are clipped by default.
-alignSky Align on the moving stars, normally using the
middle frame as target. Unmatched frames are
dropped unless the global model can recover
them.
-alignSkyFg Track stars while keeping a separate, static
foreground stack. Blend the two through an
automatic sky mask based on motion.
-alignSkyAI Like -alignSkyFg, with a downloaded DINOv3 model
helping to find the skyline. See -modelDir.
-modelDir <dir> Folder containing the downloaded model files.
Default: the Lightroom plugin's per-user model
folder. Requires -alignSkyAI.
-noSkyGlobal Disable the global sky-motion model that uses
capture times and star matches to recover
cloud-hidden frames.
-noClip Keep one-frame sky outliers such as meteors and
satellites. Otherwise -clipSigma sets the
threshold.
-skyMaskSave <file> With -alignSkyFg/-alignSkyAI, save a 16-bit gray
sky mask to this path, in rendered orientation
and crop. White = sky; black = foreground.
-skyMaskLoad <file> Use an edited sky-mask TIFF with -alignSkyFg or
-alignSkyAI. Overrides automatic mask creation;
the AI model is not needed for a loaded mask.
-alphaMask <file> Attach a sky-mask TIFF as output transparency:
foreground opaque, sky transparent. Uses the
-skyMaskSave geometry for Photoshop layering.
-skyLit With masked sky modes, preserve frames that
light the foreground instead of averaging their
light away. Default: on.
-noSkyLit Average every frame into the foreground.
-skyLitTile <px> Foreground lighting tile size. Default: 16.
-skyLitMinRegion <0-1> Smallest lit region to keep, as a fraction of
the image. Default: 0.01.
-skyLitBlend <0-1> Share of the mean retained in lit regions.
Default: 0.
STAR TRAILS AND LIGHTEN BLENDS
-trailJoin With -maximum, recover light at the joins
between consecutive trail segments. Requires
star-shaped features moving with the sky.
-trailJoinAuto Enable trail joining when capture timing and
measured sky motion qualify the frame pair.
Otherwise keep the plain maximum.
-trailChroma Repair false color along thin star trails while
preserving pixel brightness. Automatic with
trail joining; -noTrailChroma disables it.
Experimental.
-lightenFloor Remove the noise pedestal from a maximum blend,
using the frame mean as a floor. Uses sensor
noise when supported; the fallback can mistake
long trails for noise.
-noLightenFloor Keep the plain maximum without noise-floor
removal. Default for ordinary -maximum merges.
-skyTrails With -alignSkyFg/-alignSkyAI, use an unaligned
maximum for the sky and the static stack for the
foreground. Supports trail joining, color repair
and noise-floor removal.
-noSkyTrails Keep the star-aligned sky instead of trails.
Default.
DARK AND FLAT FRAMES
-dark <files...> Treat all remaining inputs as dark frames.
Average them, detect hot pixels, and subtract
only their excess from each light frame. Also
accepts -dark -files darkframe_paths.txt.
-darkThreshold <k> Hot-pixel threshold in sigmas of the averaged
dark frame's noise. Default: 5.
-flatField <file> Correct vignetting and broad color shading with
one flat-field image of an evenly lit blank
surface. Match the camera, image dimensions,
lens and aperture. Average multiple flats first
(see examples). Not supported with X-Trans pixel
shift.
DEFECT REPAIR
-cosmicray Repair transient hot pixels, cosmic-ray strikes
and readout defects in each light frame.
Protects stars and trails; works well with
-alignSky.
-cosmicrayScene <mode> auto (default): classify the scene and skip
short exposures; astro: protect stars; day:
protect sharp static detail in long daylight
exposures.
-cosmicrayThreshold <k> Transient threshold in frame-noise sigmas.
Default: 8.
-hotmap Build a persistent hot-pixel map from 8+
matching-exposure light frames with scene
motion. Static scenes risk mapping real detail.
Ignored when -dark is supplied.
-irpdaf Repair IR PDAF row banding in every input. Can
also filter a single DNG.
-hotspot Detect and subtract central glare in IR images.
Conservative; does nothing at low confidence.
-hotspotTrim <0-2> Scale the hotspot correction. Default: 1.
-hotspotForce Apply hotspot correction even at low confidence.
-skipUnrepaired With -irpdaf/-hotspot, write no output if no
repair was needed.
DNG OUTPUT AND COMPRESSION
-demosaicAuto Keep the mosaic when possible; otherwise choose
a demosaic for the sensor. Uses Adobe for
X-Trans when available. Lightroom's Auto mode.
-demosaic Write a full-color Linear DNG. Alignment modes
already demosaic as needed; this explicitly
requests linear output.
-demosaicXTrans Use the native Fujifilm X-Trans demosaic and
write a Linear DNG (Lightroom Sharper). Cannot
combine with -demosaicAuto or sky tracking.
-xtransMoire Opt in to localized two-color moire repair with
directional anti-aliasing for native X-Trans
Sharper. -noXTransMoire disables it (default).
Does not affect native Neutral.
-remosaic Demosaic, then re-encode as a Bayer mosaic for a
smaller output. Not supported for grayscale or
X-Trans output.
-demosaicMethod <1-7> Choose the demosaic method when one is needed. 2
uses Adobe DNG Converter (Lightroom Safe); 7 is
the native default. May combine with
-demosaicAuto.
-float Write 16-bit floating-point DNG samples. Pair
with -demosaic for ACR/Lightroom shadow detail.
-split <new-dir> Extract one multi-frame Pentax DNG or Fuji RAF
into a new folder, without merging/conversion.
-rmprof Remove lens distortion and other DNG opcodes.
-lossy Enable JPEG XL compression. -jxl_distance sets
loss; 0 makes it lossless. Mosaic JXL requires
-dngVersion latest, otherwise it uses lossless
JPEG.
-dngVersion <ver> Output compatibility: latest (default); 1.7.0 =
no mosaic JXL (DXO PhotoLab); 1.4.0 = no JPEG XL
at all.
-jxl_effort <1-10> JPEG XL effort. Default: 7. Higher compresses
better but takes longer.
-jxl_distance <0-25> JPEG XL loss. Default: 0.01. Higher loses more
detail; 0 is lossless. Used with -lossy.
EXTERNAL RAW CONTENTS EDITING
-export <file> Export a demosaiced TIFF for editing.
-import <file> Import an externally edited TIFF back into a
DNG.
-edit <app> Launch an editor such as Photoshop.
-wb <temp> <tint> White balance for export/import: temperature in
Kelvin and tint offset, e.g. 5500 +10. Default:
camera white balance.
-exposure <stops> Exposure compensation for editing, e.g. +1.0 or
-0.5. Adjusts the gamma curve's contrast
midpoint (alias: -exp).
-orientation <1-8> EXIF orientation: 1 = normal, 3 = 180 degrees, 6
= 90 clockwise, 8 = 90 counterclockwise.
DIAGNOSTICS
-perf Print phase timings and a summary.
-timing Print worker-thread timing information.
-validate Run DNG SDK validation on the inputs and written
output; report what another reader would see.
-alignVerbose <0-9> Alignment diagnostics. Higher levels add
feature, fit and per-track detail.
-saveMask <prefix> Save matching debug masks as TIFFs. Use "*" for
all masks; quote it to prevent shell expansion.
-testMask <prefix> Compare matching masks with saved TIFF
references. Use "*" for all masks.
-testMaxDiffPct <n> Allow n% of pixels to differ in mask
comparisons. Default: 0.
-testMaxDiff1PctPixels <n> Allow n% of pixels to differ by more than 1% in
mask comparisons. Default: 0.
-irpdafsim Inject synthetic PDAF banding to check -irpdaf.
-hotspotsim Inject a synthetic IR hotspot to check -hotspot.
MORE EXAMPLES
Recipes use the plugin's alignment/blend flags and Auto demosaic. Add
-cosmicray for automatic defect repair; with 8+ light frames, add -hotmap
too. See output options for compression and -updateEXIF for
combined-exposure metadata.
Keep a moving subject (Auto Align + Deghost):
mergeraw -demosaicAuto -alignRotate -deghost -target 0 -out subject.dng \
-files input_paths.txt
Tripod focus bracket (No Alignment + Focus Stacking):
mergeraw -demosaicAuto -focusStack depth -focusScaleOnly \
-out focus.dng -files input_paths.txt
Omit -focusScaleOnly for Auto Align; use hybrid to retain extra detail.
Star trails or light painting (No Alignment + Lighten):
mergeraw -demosaicAuto -maximum -trailJoinAuto -out trails.dng \
-files input_paths.txt
Fixed stars with a sharp landscape (Align Stars + Basic Mask):
mergeraw -demosaicAuto -alignSkyFg -out sky.dng -files input_paths.txt
Use -alignSkyAI for AI Mask; its downloaded model must be installed.
Trails with a cleaner foreground (Align Stars + AI Mask Star Trails):
mergeraw -remosaic -alignSkyAI -skyTrails -trailJoinAuto -lightenFloor \
-out skytrails.dng -files input_paths.txt
Requires the downloaded AI model. -modelDir can select its folder.
Merge rendered TIFFs directly:
mergeraw -out merged.dng frame1.tif frame2.tif
Apply dark frames while averaging a tripod stack:
mergeraw -demosaicAuto -out clean.dng -files input_paths.txt -dark \
-files darkframe_paths.txt
Correct one photo with a flat field:
mergeraw -flatField flat.dng -out corrected.dng photo.dng
Average several flats, then correct a tripod stack:
mergeraw -out flat.dng -files flatfield_paths.txt
mergeraw -demosaicAuto -flatField flat.dng -out corrected.dng \
-files input_paths.txt
flatfield_paths.txt lists matching flats, one path per line. Average them
without alignment; -flatField accepts one flat image, not a list of flats.
Save a sky mask, edit it, then rerun with the edited mask:
mergeraw -alignSkyAI -skyMaskSave sky-mask.tif -out sky.dng \
-files input_paths.txt
mergeraw -alignSkyAI -skyMaskLoad sky-mask.tif -out sky-edited.dng \
-files input_paths.txt
Edit sky-mask.tif between runs. The load run uses your mask instead of AI.
Save a focus depth map, edit it, then rebuild the same stack:
mergeraw -focusStack -focusDepthMapSave depth-map.tif -out focus.dng \
-files input_paths.txt
mergeraw -focusStack -focusDepthMapLoad depth-map.tif \
-out focus-edited.dng -files input_paths.txt
Edit depth-map.tif between runs; keep the same image size and frame order.
Map export is opt-in. Lightroom does not automatically save either map.
Guide: https://mackman.net/mergeraw/instructions.html