Nodes/ComfyUI-GGUF-Loader/Flux Klein Depth Map ⚡
ComfyUI Node

Flux Klein Depth Map ⚡

The depth map that makes a Klein edit follow the photo's geometry

By ChrisColeTech·Created about a month ago·Updated 4 days ago· 10
Flux Klein Depth Map ⚡
  • image
  • IMAGE
ckpt_namedepth_anything_v2_vitb.pth
resolution512

FLUX.2 Klein is the best open local editor of its era - the thing people reach for when they want to change a photo rather than dream a new one. And the single most useful trick in the example workflow is feeding it structure: run one reference image through a depth estimator and let the model follow the geometry while the prompt and a second reference supply the identity and content. Flux Klein Depth Map is that depth estimator, exposed as a standalone node - image in, depth map out, via Depth Anything V2.

Why you'd reach for it

Klein's real editing mechanism is reference images: a photo gets VAE-encoded and attached to the conditioning as reference_latents, and the model edits from it. The problem is that two raw photos can fight each other - one says "this pose", the other says "this face", and Klein has to split the difference. Feed one of them through depth first and you get a clean division of labour: structure from the depth map, identity and content from the other reference and your prompt. That's literally the shipped example workflow's trick, where one reference goes through a MiDaS-style depth preprocessor before encoding.

You don't always need this node. Flux Klein img2img has a control_mode of auto_depth that runs the same Depth Anything V2 in-line, which covers the common one-reference case. This node exists for when you're hand-building the graph, want to preview the depth map before it goes in, or need to chain a third or fourth reference through Flux2 Klein Multi Reference Latent.

The inputs that matter

  • image - the photo. Any size; it's resized internally.
  • ckpt_name - which Depth Anything V2 checkpoint. vits (smallest/fastest) up to vitg (largest/slowest), default vitb. First use auto-downloads into models/depth_anything_v2/.
  • resolution - processing resolution, default 512. Bump it if you're feeding a big image and want finer depth; 512 is a fine starting point.

One output, IMAGE - the depth map, ready for a Klein reference_image input or a reference_latents chain.

How it works

Depth Anything V2 is the model that ended the argument about which depth estimator to use as a preprocessor - V2 Large has been the ecosystem's default ControlNet depth source since 2024 for a reason: it generalizes to real photos, handles reflective surfaces, and produces exactly the relative near-versus-far map that conditioning wants. This port (DINOv2 encoder + DPT decoder head) is consolidated from comfyui_controlnet_aux into the pack's single-file convention. The weights download on first use, so there's nothing extra to install - unlike the pack's GGUF loader story, this is fire-and-forget.

Installing it

It ships in the same pack as all the other Klein nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/ChrisColeTech/ComfyUI-GGUF-Loader
cd ComfyUI-GGUF-Loader
pip install --upgrade gguf

Restart, and the node appears under 🤖 CCTech/Flux Klein. The gguf dependency is for the pack as a whole; this node's real install step is the first run, when Depth Anything V2 weights download themselves.

Gotchas

The depth convention matters - Depth Anything outputs near-as-white. If your downstream edit behaves inverted (near objects being treated as background), that's a preprocessor/LoRA convention mismatch, and the fix lives in the img2img node's control_invert flag. And one honest note: for the depth Control-LoRA-on-Krea2 side of the pack, this same detector is exposed as Krea2 Depth Map - same weights, different dressing. Don't install anything extra expecting a second model; the pack reuses one detector across all its auto_depth modes.

Category🤖 CCTech/Preprocessors

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
ckpt_nameCOMBOdepth_anything_v2_vitb.pthModel size. vits (smallest/fastest) to vitg (largest/slowest). Downloads on first use if not already in models/depth_anything_v2.
resolutionINT51264–2048

Outputs (1)

NameTypeDescription
IMAGEIMAGE