ComfyUI Node

VNCCS Flux Klein Encoder

Flux Klein conditioning, one node instead of five

By AHEKOT·Created 11 months ago·Updated a day ago· 1,546
VNCCS Flux Klein Encoder
  • clip
  • vae
  • image1
  • image2
  • image3
  • positive
  • negative
  • latent
prompt
upscale_methodlanczos
megapixels1.00
resolution_steps1
empty_width1024
empty_height1024
batch_size1

Five native nodes, stuffed into one box

Building a Flux Klein image in ComfyUI means assembling the same five or six nodes every single time: CLIPTextEncode, ConditioningZeroOut, ImageScaleToTotalPixels, VAEEncode, ReferenceLatent, and EmptyFlux2LatentImage. None of that is hard - it's just fiddly, and it's easy to leave a wire dangling. The VNCCS Flux Klein Encoder from the VNCCS - Visual Novel Character Creation Suite pack collapses the whole conditioning front-end into one node that hands you positive, negative, and latent, ready to feed a Flux 2 sampler.

It's not the character pipeline, mind you. VNCCS itself is the big visual-novel sprite factory (character creator, pose studio, clothes, emotions), and its v3 workflows lean on Illustrious/Anima. This node is the piece that lets that same style of workflow talk to Flux Klein - BFL's distilled 4B/9B Flux 2 line that made reference-image editing fast and cheap enough for daily use. Use it whenever you'd rather have one clean encoder than a wall of native nodes.

How it actually works

Here's the nice part: it doesn't reinvent anything. Under the hood the node calls ComfyUI's own native nodes at runtime, in this order:

  1. CLIPTextEncode your prompt with the Flux Klein text encoder → positive.
  2. ConditioningZeroOut that positive → negative. Flux doesn't use negative prompts the way SDXL does; zeroing the positive conditioning is the standard trick, and this node does it for you.
  3. For each reference image you connect (up to three), it scales it to a target size, VAE-encodes it with the Flux 2 VAE, then chains it into the conditioning through ReferenceLatent. That last bit is the important one: Klein reads reference images in-context - the model actually looks at your image while it denoises, the Kontext-style approach - not through an IP-Adapter-style embedding. That's why reference images hold identity so well.
  4. It builds the latent with EmptyFlux2LatentImage, sized to the first scaled reference if one exists, otherwise to your empty_width/empty_height.

Because it's calling live native nodes, the failure mode when your ComfyUI is too old is explicit: Required node 'ReferenceLatent' is not available. Update ComfyUI and restart it. Both ReferenceLatent and EmptyFlux2LatentImage are Flux 2-era core nodes, so an up-to-date ComfyUI is a hard requirement, not a suggestion.

The inputs that matter

You'll set exactly three required ones:

  • clip - the Flux Klein text encoder (the Qwen3-based CLIP that comes with Klein, loaded the usual ComfyUI way).
  • prompt - your positive prompt, multiline.
  • vae - the Flux 2 VAE, used for encoding the reference images.

Then the ones you'll actually touch:

  • image1 / image2 / image3 - up to three optional reference images. More references = more context, but each one gets VAE-encoded and carried through sampling, so three at high resolution will chew VRAM fast. Start with one.
  • megapixels (default 1.0) - target area each reference is scaled to before encoding. This is your detail-versus-VRAM dial; 1 MP is a sane default.
  • empty_width / empty_height (1024) - only used when no reference image is connected. Once a reference is in, the latent follows its dimensions.

The outputs are exactly the three you wire into your sampler: positive and negative CONDITIONING into the KSampler's conditioning slots, and latent into the latent slot.

Install

Grab it from ComfyUI Manager (search "VNCCS - Visual Novel Character Creation Suite") and click Install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/AHEKOT/ComfyUI_VNCCS.git

Then restart ComfyUI and, per the README, run Manager's Install missing custom nodes to pull the heavy deps - this pack ships a real dependency list: opencv-python, kornia, pymatting, transparent-background, timm, transformers, and llama-cpp-python (used by the pack's tag wizard, not this node). Make sure the pip install -r requirements.txt lands in the same Python environment as your ComfyUI, or Manager does it for you.

Common issues

  • Required node ... is not available. Update ComfyUI and restart it. - your ComfyUI predates Flux 2 support. Update it.
  • VRAM spikes - default 1 MP per reference plus a batch of batch_size isn't free. Klein 4B runs in ~8.5 GB, Klein 9B needs ~19 GB; if you're on the edge, drop megapixels or use fewer reference images.
  • Wrong latent size - connect a reference and the node picks its dimensions automatically, so if you're seeing weird aspect ratios, check what the reference actually is before blaming the node.

It's a thin, honest wrapper - but it's exactly the kind of wrapper that keeps a Flux Klein workflow from turning into spaghetti.

CategoryVNCCS/encoding

Inputs (12)

NameTypeDefaultDescription
clipCLIPFlux Klein text encoder.
promptSTRINGPositive Flux Klein prompt.
vaeVAEFlux 2 VAE used for reference images.
image1optIMAGEFirst optional reference image.
image2optIMAGESecond optional reference image.
image3optIMAGEThird optional reference image.
upscale_methodoptCOMBOlanczosReference image scaling method.
megapixelsoptFLOAT1.000.01–16Target area for each connected reference image.
resolution_stepsoptINT11–256Resolution step passed to Scale Image to Total Pixels.
empty_widthoptINT102416–16384Latent width used only when no reference image is connected.
empty_heightoptINT102416–16384Latent height used only when no reference image is connected.
batch_sizeoptINT11–4096

Outputs (3)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT