EditUtils: Flux2Klein Edit Apply (ROPE Control) lrzjason
Move References Around the Canvas
- model
- model
The Flux 2 architecture has a genuinely handy built-in: its process_img step accepts per-image position offsets (h_offset/w_offset), which is exactly what you need to tell the model where on the canvas a reference belongs. Stock ComfyUI doesn't surface that. Flux2KleinEditApply_EditUtils patches a Klein model to read per-reference ROPE offsets out of the EditUtils conditioning chain and feed them into those calls - turning "regional editing" from a re-crop-and-hope exercise into a pair of sliders.
The interface is the model in, model out. Required: model. Optional: ref_pos_match_target (default False), debug_log. And that's the whole node, because the offsets themselves live upstream on the Config Preparer (rope_x_offset/rope_y_offset), get packed into each image's config, and travel to the model inside the conditioning - the same invisible reference-latents chain the rest of the pack uses. This node is the reader at the end of that chain.
The one setting that actually matters is ref_pos_match_target, and its default is the trap. Leave it False and each reference keeps its own spatial offsets - which is the regional-editing mode the ROPE knobs exist for: a reference nudged rope_x_offset rightward genuinely occupies that region of the canvas. Flip it True and the patch instead stretches reference position IDs to cover the whole target grid - the mode you want when reference and target resolutions differ and you need the reference content spread across the full canvas rather than parked in the top-left. In plain terms: False = "put this reference where I say," True = "cover the target with this reference." The node description tells you to leave it False for regional editing with rope offsets. Start there.
Mechanically it's a model patch with the same safety rails as the rest of the family: it detects a real Flux model by checking for process_img and pe_embedder attributes, clones the model so the patch is isolated (your base model object is untouched), patches extra_conds to intercept reference_rope_offsets from the conditioning, and patches the forward pass to apply each reference's h_offset/w_offset in process_img. Hand it a non-Flux model and it returns it unpatched. The debug_log toggle prints what the offset injection is doing - flip it on the first time your offsets "do nothing."
One honest caveat: this is precision plumbing for the Klein family, and it's the kind of node you reach for after you've got a basic edit working, not before. Get a plain Klein edit running with the one-shot encode node, then add ROPE control once you're fighting positioning. Install: ComfyUI Manager (search "EditUtils") or git clone https://github.com/lrzjason/ComfyUI-EditUtils into custom_nodes, restart. No extra dependencies, and the Klein checkpoint plus its Qwen3 encoder and VAE are files you bring.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| ref_pos_match_targetopt | BOOLEAN | false | Stretch ref positions to cover target grid. Set False for regional editing with rope offsets. |
| debug_logopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |