Formats and metadata
Input
| Format | Bit depths | Notes |
|---|---|---|
| PNG | 8, 16 | |
| JPEG | 8 | |
| TIFF | 8, 16 | Uncompressed TIFF decodes an order of magnitude faster than PNG |
| Camera raw | — | NEF, CR2, CR3, ARW, DNG, RAF, ORF, RW2, PEF, IIQ, 3FR and the rest of what rawler decodes, recognized by extension |
A directory among the command line's inputs stands for the image files in it, in natural order
(f2 before f10).
Frames of different sizes
A frame that is not frame 0's size is resampled to it — each axis independently, with a spline 4×4 kernel — and the run says so. A frame of the wrong aspect will be visibly stretched.
Output
Output keeps the input's bit depth. Sixteen bits need PNG or TIFF; a raw counts as
sixteen-bit. A .dng output writes a linear DNG.
TIFF output is written by lapstack's own uncompressed writer, which is what lets it put EXIF and GPS sub-IFDs where they belong.
| Output | Format |
|---|---|
| Stacked image | PNG, JPEG, TIFF, or DNG |
| Weighted average | The output's format (DNG when the output is) |
| Slabs | The output's format, in <stem>_slabs/ |
| Depth map | 8-bit gray PNG (min–max scaled), or 16-bit PNG on a fixed scale (65535 = last frame) |
| Confidence map | 16-bit PNG (65535 = 1) |
| Stereo pair | The output's format (DNG when the output is) |
| Rocking views | TIFF natively; GIF, MP4 or WebM in the browser |
| 3D model | GLB, or OBJ + MTL + texture, or STL |
How camera raws are developed
Two different paths, depending on the output.
For an ordinary output
Each raw is developed as shot: black and white levels, demosaic, the white balance the camera recorded, the camera's color matrix to sRGB, the sRGB curve. That produces the sixteen-bit RGB every other input becomes, turned the way the EXIF orientation says. A monochrome sensor gives gray.
No exposure or tone adjustment is applied, deliberately. The frames of a stack are shot alike, and what the fusion needs is that they are developed alike. When the look matters, develop the stack in a raw converter first — identically for every frame — and give lapstack the TIFFs.
Developing costs more than decoding: about a second per 24-megapixel frame natively across all cores, several seconds in the browser, which develops on one thread.
For a linear DNG output
Each raw is decoded to the camera's own linear space — black and white levels, demosaic, the sensor's crop, turned by its orientation, and nothing else — and the stack is fused in a look space made from frame 0's as-shot white balance and the camera's D65 matrix followed by the sRGB curve, with nothing clipped: the curve is extended above 1 and mirrored below 0, so a highlight past white or a color outside sRGB keeps its value and the transform stays invertible.
The result is taken back through the inverse curve, matrix and white balance into camera space, and written as a DNG 1.4 with:
| Tag | Value |
|---|---|
PhotometricInterpretation | LinearRaw |
| Bits per sample | 16 |
WhiteLevel | 65535 |
ColorMatrix1 / ColorMatrix2 | The camera's, with their illuminants — the cooler light first, as Adobe writes them |
AsShotNeutral | The reciprocal of the white balance, green = 1 |
UniqueCameraModel, Make, Model | The camera's |
| Exif IFD, XMP | The first frame's |
Orientation | 1 |
No ICC profile: a DNG's color is its matrices.
A stack must be all raws or none. Frames that are not raws are taken as sRGB — their linear
values are the "camera space", ColorMatrix1 is XYZ → sRGB at D65 and the neutral is 1, 1, 1 —
so any stack can come out as a DNG, but only a raw stack's carries more than its files did.
Verified: darktable develops a lapstack DNG from five Nikon Z 8 NEFs and the first NEF to the same colors and brightness.
Metadata
The output carries the first frame's metadata: its EXIF, its ICC profile and its XMP packet.
--no-metadata turns it off, and the browser's Save step has the same switch (its Metadata
section also reports what was found).
The EXIF is rebuilt rather than copied wholesale:
- The MakerNote and thumbnail are dropped
- Software is set to lapstack
- The pixel dimensions are set to the result's
Where it goes, per format:
| Format | Where |
|---|---|
| PNG | eXIf, iCCP / cHRM, and iTXt chunks |
| JPEG | APP1 and APP2 segments |
| TIFF | IFD0, with the Exif and GPS sub-IFDs |
| DNG | The Exif IFD and XMP; color is the matrices, so no ICC profile |
For a TIFF without an ICC profile, its white point and primaries are carried across as well.
A raw's EXIF Orientation is reset to 1 in every output — the frame was already turned as it was decoded, and a viewer must not turn the result again.
Capture times
Used by the batch split and the {date} / {time} caption tokens, read in
this order:
- EXIF
DateTimeOriginal, with its sub-seconds - EXIF
DateTimeDigitized - EXIF
DateTime - The XMP packet's
CreateDate— raw converters write TIFFs with XMP and no EXIF - The file's modification time, and the run says so
Reading them is cheap: only the head of each file is read, or for a TIFF whose IFD follows the pixels, a window around that IFD. A hundred frames of 274 MB each take about 0.2 s.
A raw's capture time is read from its TIFF structure where it has one (NEF, CR2, ARW, DNG) and otherwise by rawler's own reader (CR3, RAF), which reads the whole file.
Focus distances
Used to decide which end of the stack is near, for the stereo, rocking and 3D outputs.
The standard EXIF SubjectDistance is read by lapstack itself, from the TIFF structure or the
XMP. Most cameras keep the distance in their MakerNote instead — Nikon's is even encrypted — so
when exiftool is on the path the command line asks it for SubjectDistance, FocusDistance,
Canon's FocusDistanceUpper and Lower, and Sony's FocusDistance2 (two calls, about 0.1 s
each).
The browser has its own EXIF reader and cannot see into a MakerNote, so a stack whose camera keeps the distance there falls back to frame 0 near, and the Save step says which cue decided.
Scale-bar calibration
Read from the first frame's TIFF when --scale-bar auto is used:
| Source | Field |
|---|---|
| ImageJ | unit=micron in the ImageDescription, with XResolution in pixels per unit |
| OME-XML | PhysicalSizeX and PhysicalSizeXUnit |
| A plain resolution | In cm or inch, only from a writer with no Make tag — a camera's 72 or 300 dpi says nothing about the subject |
Content credentials
C2PA credentials can be attached to every file the browser saves — except videos, which carry none, and 3D models, which carry none. See saving.