Nodes/Comfyui-Distill-Any-Depth/Distill Any Depth Process Image
ComfyUI Node

Distill Any Depth Process Image

The node that turns any flat image into a depth map

By zade23·Created about a year ago·Updated 6 months ago· 6
Distill Any Depth Process Image
  • pipeline
  • image
  • depth_image
processing_resolution756
output_typecolorized

Feed this node a picture and it hands you back a depth map - a grayscale (or rainbow) version of the same image where brightness encodes how far each pixel is from the camera. That map is the workhorse of half the ecosystem: it's what a depth ControlNet uses to redraw a scene in a new style while keeping the spatial layout, and it's the raw material for parallax "living photo" animations, VR conversion, and displacement geometry. The node itself is pure preprocessing. It just estimates depth and outputs an image; everything downstream decides what to do with it.

Why you'd reach for this instead of the usual suspects

Depth Anything V2 via comfyui_controlnet_aux has been the community default since 2024 and it's still the right answer for most people. This node is for when you specifically want a Distill-Any-Depth map - the distilled-student depth model from Westlake AGI Lab, where a big teacher supervises smaller students so they get close to teacher quality at a fraction of the compute. The pack is young and barely has a community footprint yet, so treat it as the interesting new option, not the settled one.

How it works

The node needs a pipeline (DISTILLPIPE) from the pack's Download Distill Any Depth Model node - that's where the weights come from. Your image gets resized to a square processing_resolution for the model, normalized with ImageNet stats, and pushed through the network to produce a disparity prediction. That gets normalized to 0–1, colorized or grayed, then resized back to your original image's width and height before being returned as a standard ComfyUI IMAGE.

The inputs that matter

There are four, and only two of them are worth thinking about:

  • pipeline - the DISTILLPIPE from the Download node. Non-negotiable.
  • image - your input. One frame only: if you feed it a batched tensor it silently takes the first element, so don't try to use this for video in one pass.
  • processing_resolution - default 756, range 64–2048. This is the square resolution the model actually runs at. Higher means finer detail at the cost of speed and VRAM. The tooltip warns it must be a multiple of 14 - the resize transform enforces that internally, so keep the value sensible and you won't trip over it. Drop it to 512-ish if the Large or Teacher models are OOMing.
  • output_type - colorized (default, a Spectral colormap rainbow), grayscale, or grayscale 16-bit.

One honest quirk: the "grayscale 16-bit" mode computes at 16-bit precision but then normalizes back to a 0–1 float tensor, which is exactly what every other ComfyUI image is. So inside ComfyUI it behaves identically to the 8-bit grayscale - it only matters if a downstream tool actually consumes 16-bit data.

Wiring it up

The single output, depth_image (IMAGE), feeds two kinds of things:

  • ControlNet - into Apply ControlNet with a depth model, using typical depth-ControlNet weights (loose ~0.4–0.7, strict ~0.8–1.1). The depth map constrains the composition; it doesn't need to match pixel-for-pixel.
  • Parallax / geometry - into DepthFlow-style nodes, VR conversion, or anything that warps an image along Z. Keep parallax subtle; beyond the original camera view there's no pixel data and the image starts to tear.

You can also just Save Image to eyeball the map itself. Note the output is relative depth (near vs. far), not metric distance - irrelevant for ControlNet, wrong for measurement.

Installing it

It's the whole pack - there are only two nodes and this is the other half.

cd ComfyUI/custom_nodes
git clone https://github.com/zade23/Comfyui-Distill-Any-Depth
cd Comfyui-Distill-Any-Depth
pip install -r requirements.txt

Then restart ComfyUI. Or search Comfyui-Distill-Any-Depth in ComfyUI Manager. The model downloads itself on first run (via the Download node) into ComfyUI/models/distill_any_depth/, so there's nothing to fetch by hand. requirements.txt needs huggingface_hub, opencv-python, and scipy; torch and torchvision come from your ComfyUI install.

Common issues

Beyond the first-run download and the single-frame limit, the main gotchas are resource-shaped: the Large and Teacher models are slow and VRAM-hungry at high processing_resolution, and the Teacher-Large variant especially will punish weak cards. The model is moved back off the GPU after each pass, so memory pressure is transient. And if your depth map looks noisy at the edges, that's not a bug in the node - it's the tradeoff you signed up for with a distilled student. Swap to the Teacher model if you need it cleaner.

CategoryDistillAnyDepth

Inputs (4)

NameTypeDefaultDescription
pipelineDISTILLPIPE
imageIMAGE
processing_resolutionINT75664–2048Processing resolution, must be multiple of 14
output_typeCOMBOcolorizedOutput type: colorized depth map or grayscale depth map

Outputs (1)

NameTypeDescription
depth_imageIMAGE