Remap Depth
Stretch a depth map's range so its detail actually shows
- image
- IMAGE
A depth map's values don't always spread across the full range a human eye can distinguish. If your scene is mostly midground with one distant background sliver, most of the image can end up crammed into a narrow band of grays - technically accurate, visually mushy. Kijai added this node specifically for that: it's a linear remap that stretches (or compresses) the value range so the detail that's actually there becomes visible, instead of being flattened by a scene with limited depth variation.
Why it exists
Straight from the pack's own README: "I added a remap node to see the full range better." That's the entire motivation, and it's honest about being a visualization/preparation utility rather than anything that changes what the depth data means. If your generation, 3D tool, or ControlNet is only ever seeing a narrow gray band because the original scene didn't have much depth variation to begin with, this node redistributes that range across the full 0-1 span so downstream tools - and your own eyes - have more to work with.
How it works
It's a straightforward linear remap: values at your input min get mapped to black, values at your input max get mapped to white, and everything between is scaled proportionally. Set min and max to the actual range your depth data occupies (rather than the theoretical 0-1 default) and the node stretches that narrower band across the full output range. clamp decides what happens to anything outside your chosen min/max - clip it to black/white, or let it extend past the normal 0-1 range.
The inputs and outputs that matter
Three settings, all of them worth understanding:
min(default 0, range -10 to 1) andmax(default 1, range 0 to 10) - the input value range you want mapped to black and white respectively. The defaults (0 to 1) are a no-op - you have to actually narrow this to your scene's real range to get the stretching effect. If your depth map's real values only span roughly 0.2 to 0.6, setminto 0.2 andmaxto 0.6 and watch the contrast open up.clamp(default true) - with clamping on, anything beyond yourmin/maxgets hard-clipped to pure black or white. Turn it off if you'd rather let values run past the normal range (useful if you're piping the result somewhere that reads float values beyond 0-1, likeSaveImageOpenEXR, rather than a standard 8-bit image consumer).
One output, named simply IMAGE in the schema - the remapped depth map, same shape as the input.
How to install it
No separate install - same pack as every Marigold node. ComfyUI Manager: search "marigold", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-Marigold
pip install -r ComfyUI-Marigold/requirements.txt
Nothing to download for this node itself - it's a plain image-processing op, so it runs essentially instantly compared to the diffusion nodes feeding it.
Common issues & troubleshooting
Nothing visibly changes after remapping. Check whether you actually narrowed min/max from the defaults - leaving them at 0 and 1 is a pass-through, since that's already the full range a standard depth map occupies. You need to know (or eyeball, via ColorizeDepthmap first) roughly where your actual data sits before this node does anything useful.
Output looks blown-out or crushed, all near-white or near-black. You likely set min/max tighter than the data actually spans, so most of the scene got clipped to one extreme. Widen the range back out, or preview with ColorizeDepthmap first to see where the real values fall before committing to a tight remap.
Feeding this into a ControlNet gives worse results than the raw map. Aggressive remapping can distort the depth relationships a ControlNet relies on - if you stretch contrast too hard, near-identical distances can get pushed to opposite ends of the range and the conditioning reads as sharper spatial separation than the scene actually has. Use this node for visualization and export prep (pairing well with SaveImageOpenEXR), and feed ControlNet the untouched map unless you have a specific reason to remap first.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| min | FLOAT | 0.00-10–1 | — |
| max | FLOAT | 1.000–10 | — |
| clamp | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |