ComfyUI Node

TS Image Depth

Depth maps for stills that actually hold their range

By AlexYez·Created 2 years ago·Updated a day ago· 12
TS Image Depth
  • images
  • image
model_filenamedepth_anything_v2_vitl_fp16.safetensors
max_res-1
precisionfp16
colormapgray

TS Image Depth is the still-image half of the Timesaver depth pair, and it exists because the video half made a mess of pictures. Feed a single photo into a video depth model and it gets treated as 32 duplicated frames, which flattens the range - faces blow out to flat white. This node runs Depth Anything V2 Large on every image on its own, exactly the way the reference implementation does, so a portrait keeps its facial structure and a 1600 px photo doesn't get shoved through at 518 px.

Depth Anything V2 has been the default depth preprocessor for ControlNet since it shipped, and the whole community argument about "which depth model do I use" settled on this family. This node just wraps the Large checkpoint without inventing anything on top of it.

How it works

The pipeline is deliberately bare: trim the sides to a multiple of 14 (the DINOv2 patch grid), run the model, normalize each picture against its own min/max, resize back bilinearly. No denoise, no dither, no guided upscale - those exist to keep video steady, and on a still the guided filter just puts a halo on contours. Measured against the reference implementation the map differs by about 0.36%, under one 8-bit level.

Weights are fp16 safetensors, downloaded on first use into ComfyUI/models/depthanything/. Half the download of the old .pth, and they load in hundredths of a second instead of a full one. The measured difference from pure fp32 is 0.02% of the depth range, which is nothing.

The inputs that matter

There are five, and only one really demands your attention.

  • images - a picture or a batch of unrelated pictures. Every one is processed and normalized on its own; a batch here does not mean a video.
  • model_filename - the Depth Anything V2 checkpoint. The default fp16 safetensor is the right call; leave it.
  • max_res - the one that matters. The longest side the picture is processed at, snapped down to a multiple of 14. -1 (the default) is native resolution, so nothing gets resampled and nothing is lost. 1540 is noticeably quicker on big photos and still sharp. Lower it when VRAM is tight - and if the node hits OOM it retries at half the size on its own, logging each step.
  • precision - fp16 vs fp32. fp16 is twice as fast at half the VRAM and the difference is 0.02%. Take fp32 only if you're chasing the last bit on a smooth surface and have VRAM to burn.
  • colormap - gray (default) is the raw normalized depth in all three channels, which is what downstream nodes want. Pick inferno/viridis/plasma/magma/cividis only when you're looking at the map on screen; they're matplotlib colormaps with bilinear LUT interpolation so no banding.

The single output is image: the depth map as an ordinary IMAGE at the original resolution, values in 0..1. Wire it straight into a depth ControlNet, a 2.5D parallax setup, or a save node.

Installation

This node ships in the comfyui-timesaver pack. ComfyUI Manager is the easy path: search "Timesaver", install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-timesaver
cd comfyui-timesaver
python -m pip install -r requirements.txt

Restart ComfyUI after. On the Windows portable build, run pip from python_embeded\python.exe so dependencies land in the right interpreter; on macOS/Linux use the same venv Python ComfyUI runs with. Every node in the pack appears under TS/<Category> in the right-click menu.

Troubleshooting

  • Out of memory: lower max_res. Depth Anything V2 stops gaining much above roughly 2000 px anyway, so you're not giving up much.
  • Weights not found on first run: they download automatically on first use. If it's stuck, check that huggingface_hub installed cleanly - it's in the pack's requirements.
  • The map looks flat: check colormap is gray for feeding into nodes, and remember the range is normalized per image, so a low-contrast scene produces a low-contrast map by design.

If your input is a sequence that needs to stay steady frame to frame, that's the job for TS Video Depth - a sliding-window Video Depth Anything with temporal smoothing. For a single still, this is the one.

CategoryTS/Image/Depth

Inputs (5)

NameTypeDefaultDescription
imagesIMAGEPicture, or a batch of pictures, as IMAGE (N, H, W, 3) in 0..1. Every picture is processed and normalized on its own — a batch here means unrelated images, not a video.
model_filenameCOMBOdepth_anything_v2_vitl_fp16.safetensorsDepth Anything V2 checkpoint, downloaded on first use to ComfyUI/models/depthanything. fp16 safetensors is half the download and loads far quicker; measured against pure fp32 it differs by 0.02% of the depth range, which is nothing.
max_resINT-1-1–8192Longest side the picture is processed at, snapped down to a multiple of 14 (the DINOv2 patch grid). The only quality control here. • -1 (default) — native resolution, exactly what the reference implementation does. Nothing is resampled, so nothing is lost. • 1540 — noticeably quicker on large photos and still sharp; the map comes back up to full size bilinearly. • lower — when VRAM is tight. Depth Anything V2 stops gaining much above roughly 2000 px, so raising this without limit buys little. On out-of-memory the node retries at half the size, and again, logging each step.
precisionCOMBOfp16Inference dtype. • fp16 (default) — 2x faster, ~50% less VRAM. • fp32 — measured difference against fp16 is 0.02% of the depth range. Worth it only if you are chasing the last bit on a smooth surface and have the VRAM to spare.
colormapCOMBOgrayOutput color mapping. • gray (default) — the raw normalized depth in all three channels, which is what the reference returns. Use this when the map feeds another node (ControlNet, 3D, and so on). • inferno / viridis / plasma / magma / cividis — perceptually uniform matplotlib colormaps, for looking at. Bilinear LUT interpolation removes 8-bit banding.

Outputs (1)

NameTypeDescription
imageIMAGEDepth map as IMAGE (N, H, W, 3) float in 0..1 at the original resolution. An ordinary IMAGE — feed it straight into ControlNet, a save node, and so on.