Nodes/comfyui-krea2-controlnet/Krea2 Control Image Encode
ComfyUI Node

Krea2 Control Image Encode

Turning a depth map into a Krea 2 latent — without running a single preprocessor

By facok·Created 2 months ago·Updated 2 months ago· 207
Krea2 Control Image Encode
  • control_image
  • vae
  • latent
  • control_latent
  • encoded_control_image
resizematch_latent_size
upscale_methodlanczos
cropcenter
channel_modergb
normalizenone
invertfalse
batch_modeindependent_images

The name is doing honest work: this node encodes a control image. It does not detect depth, run Canny, or find poses - there's not a single preprocessor hiding inside it. You bring the map, ideally already run through comfyui_controlnet_aux (Depth Anything, Canny, OpenPose, lineart, normal maps all work), and Krea2 Control Image Encode does the VAE math that turns it into a latent the Krea 2 control LoRA can actually read.

Why latents and not the raw image? Because Krea 2's control is a LoRA, not a classic ControlNet. There's no separate condition encoder waiting for pixels; instead the control signal becomes extra tokens injected through an expanded input projection. That means whatever you want to steer the generation with has to live in the same latent space the model sees - which is exactly what this node produces.

Mechanically it's a short chain of lightweight tensor ops before the encode. It clamps the image, optionally converts to grayscale and back to RGB, optionally normalizes each image to its own min/max range, optionally inverts, resizes if you asked it to, then runs the Krea2/Qwen VAE's encode. Nothing heavy, nothing that eats a second model into VRAM.

The inputs that actually matter

Most of the options are "set once and forget," but four deserve your attention:

  • control_image - your preprocessed map. Feed it the depth/canny/pose output, not a raw photo.
  • vae - must be the Krea2/Qwen image VAE, the same one the model uses. Any other VAE and the latent's channel count will be wrong; the Apply node will catch it, but catch it here.
  • latent (optional, but treat it as required) - the sampler's latent. When resize is match_latent_size (the default), this input is how the node knows what resolution to resize the control image to. The reference workflow resizes the control image to the final generation size before encoding, so this is the setting you want. Switch to keep_control_image_size only if you've already resized and cropped the map yourself.
  • channel_mode / normalize / invert - the depth recipe lives here. For the public depth LoRA (Patil/Krea-2-depth-controlnet) with a Depth Anything output, the README's starting point is grayscale + per_image_minmax + invert=false. Turn invert on only if the depth preview shows near objects as dark instead of white. Canny, pose, lineart and normal maps should stay on rgb + none + false.

One more setting worth understanding: batch_mode. Defaults to independent_images, which encodes each image in a batch separately - the right behavior with the 3D Krea2/Qwen VAE. video_frames preserves ComfyUI's usual video-style VAE behavior if you're feeding frames.

Outputs

  • control_latent (LATENT) - wire this into Krea2 Control Apply.
  • encoded_control_image (IMAGE) - the processed map, handy to pipe into a preview node so you can see what the model is actually being conditioned on before you spend a minute generating.

Installing

Same pack as the rest of this pipeline - ComfyUI Manager, search "comfyui-krea2-controlnet", or:

cd ComfyUI/custom_nodes
git clone https://github.com/facok/comfyui-krea2-controlnet

Restart and you're done. No requirements.txt, no extra pip installs, and the node runs the VAE you already have loaded.

Where people get burned

The classic one: resize left on match_latent_size with nothing connected to latent, which fails with a message that reads like a riddle - "needs a LATENT input when resize is match_latent_size." It's telling you the sampler latent is missing; wire it in. The second classic is a gray or washed-out control because the preprocessor's convention is inverted from the LoRA's training data - flip invert and re-check the preview. And if you get a channel mismatch later at Apply time, you encoded with the wrong VAE. All three are five-second fixes once you know what to look at.

CategoryKrea2/control

Inputs (10)

NameTypeDefaultDescription
control_imageIMAGE
vaeVAE
resizeCOMBOmatch_latent_size2 options: keep_control_image_size, match_latent_size
upscale_methodCOMBOlanczos5 options: lanczos, bicubic, bilinear, area, nearest-exact
cropCOMBOcenter2 options: center, disabled
channel_modeCOMBOrgb2 options: rgb, grayscale
normalizeCOMBOnone2 options: none, per_image_minmax
invertBOOLEANfalse
batch_modeCOMBOindependent_images2 options: independent_images, video_frames
latentoptLATENT

Outputs (2)

NameTypeDescription
control_latentLATENT
encoded_control_imageIMAGE