Nodes/ComfyUI-EditUtils/EditUtils: Flux2Klein Config Preparer lrzjason
ComfyUI Node

EditUtils: Flux2Klein Config Preparer lrzjason

Unlimited Reference Images for Klein, One Chained Config at a Time

By lrzjason·Created 7 months ago·Updated 16 days ago· 207
EditUtils: Flux2Klein Config Preparer lrzjason
  • image
  • configs
  • mask
  • configs
  • config
to_reftrue
ref_main_imagetrue
ref_longest_edge1024
ref_croppad
ref_upscalelanczos
ref_resize_modelongest_edge
rope_x_offset0
rope_y_offset0

Flux 2 Klein does multi-reference editing natively - it's one of the reasons it displaced single-editor checkpoints in a lot of workflows. Flux2KleinConfigPreparer_EditUtils is how this pack points Klein at a batch of references with full per-image control. The one-shot encode node caps you at three images and hides the knobs; this is the node that removes both limits.

The mechanism is the chain, and it's worth internalizing because it's the same trick across every Preparer in this pack. The node takes one image plus its processing options, wraps them into a config dict, and appends that dict to a configs list. Because configs is also an input, you chain Preparers end to end: first one starts the list, each following one appends, and the finished list flows into EditTextEncode_EditUtils.configs. The README says it plainly - the multi-config path is unlimited images. Virtual try-on with three refs, character sheets, scene composites with five - this is the node that feeds them.

Per image you're setting two groups of things. The reference group: to_ref (does this image become a reference latent at all), ref_main_image (is this the one whose latent becomes the sampler's starting canvas - set it on exactly one, or the first becomes default), and the resize set: ref_longest_edge (1024 default), ref_resize_mode (longest_edge scales so the longest dimension hits that number; area scales so total pixels equal ref_longest_edge²), ref_crop (pad, center, or disabled), and ref_upscale (lanczos, bicubic, area). The ROPE group: rope_x_offset and rope_y_offset, both VAE-aligned pixel offsets that shift where a reference sits on the canvas - regional editing's steering wheel. Note what's absent: no vision-tower settings. Klein doesn't use a vision tower the way Boogu does, so to_vl and friends simply don't exist on this node.

The mask input has the one rule you'll actually trip on: it must match the image's exact height and width, or the node drops it with a console warning. Slight mismatch in a resize chain and your masked region quietly stops being masked. And the Krea 2 depth workflow in this repo shows the natural wiring: LoadImage → ConfigPreparer → EditTextEncode → EditApply → KSampler, where the reference latent flows through the conditioning chain automatically - which is also why the ROPE offsets here require Flux2KleinEditApply_EditUtils on the model path to take effect.

Install is the pack standard: ComfyUI Manager (search "EditUtils") or git clone https://github.com/lrzjason/ComfyUI-EditUtils into custom_nodes, restart. The Klein checkpoint (remember: 4B and 9B LoRAs don't mix, and the 9B sits under the non-commercial Flux license), its Qwen3 text encoder, and the VAE are files you fetch yourself - this pack is the plumbing, not the weights.

Categoryadvanced/conditioning

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
configsoptLISTConfigs list
to_refoptBOOLEANtrueAdd image to reference latent
ref_main_imageoptBOOLEANtrueSet image as main image which would return the latent as output.
ref_longest_edgeoptINT102416–4096Longest edge of the output latent
ref_cropoptCOMBOpadCrop method for reference image
ref_upscaleoptCOMBOlanczosUpscale method for reference image
maskoptMASK
ref_resize_modeoptCOMBOlongest_edgelongest_edge: scale so the longest dimension equals ref_longest_edge. area: scale so total pixels equals ref_longest_edge squared.
rope_x_offsetoptINT00–4096ROPE horizontal position offset in pixels (VAE-aligned). Shifts reference rightward on canvas. Requires model EditApply node.
rope_y_offsetoptINT00–4096ROPE vertical position offset in pixels (VAE-aligned). Shifts reference downward on canvas. Requires model EditApply node.

Outputs (2)

NameTypeDescription
configsLIST
configANY