AnyImagetoConditioning_flux_kontext(mki-任意数量图像转条件-flux_kontext)
AnyImagetoConditioning_flux_kontext
- conditioning
- vae
- CONDITIONING
FLUX.1 Kontext is Black Forest Labs' in-context editor: instead of injecting reference images through an adapter like IPAdapter, it concatenates them into the model's context alongside the prompt. That's what makes it so good at holding a character across edits. In ComfyUI, that reference mechanism lives in the conditioning as reference_latents - and feeding them in is exactly what AnyImagetoConditioning_flux_kontext_makki does. You give it a conditioning, a VAE, and one or more images; it returns the same conditioning with those images baked in as reference latents.
This is a specialist's node. If you're not running a Kontext workflow, skip it. If you are - meaning you've got the FLUX.1-Kontext-dev checkpoint loaded and its custom sampling workflow - this saves you from the fiddly part of getting images into the right form for Kontext to read.
How it works
For each image you plug in, the node does three things:
- Scales it to a Kontext-friendly resolution. It picks the closest of 16 preferred Kontext resolutions (aspect-ratio pairs like 1024×1024, 800×1328, 1392×752) to your image's aspect ratio, then resizes with Lanczos and center-crops. Kontext has specific resolutions it likes, and feeding it an arbitrary one is a recipe for artifacts or outright failure.
- Encodes it with the VAE you supplied into a latent.
- Appends it to the conditioning's
reference_latents, usingappend=Trueso multiple images stack rather than overwrite.
The output CONDITIONING then feeds the Kontext sampler just like any conditioned prompt.
Inputs and outputs
- conditioning (required) - the text conditioning you want the reference latents attached to. Wire it from the Kontext text encoder path.
- vae (required) - the VAE used to encode reference images.
- Dynamic image inputs - connect the first image and another slot appears; keep going for as many references as you want. Same dynamic-slot behavior as the pack's
AnyImageStitch. - Output:
CONDITIONING.
Gotchas
- It needs the Kontext weights, and those are heavy and licensed. Kontext is a 12B model under BFL's non-commercial FLUX.1 dev license - which, since the Kontext-era update, also carries an anti-circumvention clause. No NSFW fine-tunes, no commercial hosting. Qwen-Image-Edit is the common escape hatch if that's a problem.
- Resolution scaling is deliberate, not decorative. If your reference is a weird aspect ratio, the node snaps it to the nearest preferred Kontext resolution. That's the mechanism doing its job - resist "fixing" it unless you know the sampler you're using tolerates odd sizes.
- This node is only the reference half of the pipeline. You still need the Kontext checkpoint, its text encoder, and the Kontext-specific sampler setup. Expect to assemble that workflow from a template first.
Installing
Part of ComfyUI-MakkiTools:
cd ComfyUI/custom_nodes
git clone https://github.com/MakkiShizu/ComfyUI-MakkiTools
cd ComfyUI-MakkiTools
pip install -r requirements.txt
Restart ComfyUI. If your reference images keep coming out misshapen or the conditioning seems to ignore them, check that you're feeding the output into a Kontext (not a vanilla Flux dev) sampler - that's the failure mode people actually hit.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | Input conditioning 输入条件 | |
| vae | VAE | VAE model VAE模型 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |