EditUtils: QwenImage Edit Apply (ROPE Control) lrzjason
Put each reference exactly where you want it — ROPE-positioned regional editing
- model
- model
Here's the problem this node solves: normally a Qwen-Image edit takes your reference and lets the model decide where it goes. If you're compositing - "put this product into this scene," "place this character here" - you want to tell the model where, in pixel coordinates, the reference belongs. QwenImageEditApply_EditUtils is the model-patch node that makes that possible, by injecting per-reference ROPE position offsets into a QwenImage model's forward pass.
The mechanism is worth understanding because it's elegant. QwenImage (the architecture under Qwen-Image-Edit) natively supports h_offset/w_offset when it processes an image into position IDs. Normally nobody touches that. This node patches the model so that when it reads the EditUtils conditioning chain, it also pulls out reference_rope_offsets (a list of (x, y) pixel offsets, one per reference) and passes them into each reference's process_img call. Net effect: each reference image gets its position IDs shifted on the canvas - the reference literally sits where you put it, instead of floating.
Inputs are minimal: model (MODEL, required) and two optional booleans, ref_pos_match_target (default false) and debug_log (default false). The node's own description is blunt and correct: "Connect only the model wire - rope offsets flow through the EditUtils conditioning chain automatically." The offsets are set on the conditioning side, via rope_x_offset/rope_y_offset on QwenConfigPreparer_EditUtils (or generated from a mask by RopeOffsetFromMask_EditUtils). This node just consumes them.
The ref_pos_match_target flag is the one real decision here:
false(default) - each reference keeps its own given offset. This is the regional-editing mode: set offsets from a mask's bounding box and the reference lands in that region.true- stretch reference position IDs to cover the target grid. That's the "reference fills the canvas" behavior you'd use when the ref is a different resolution than the target and you want it to map fully.
If you pass it a non-QwenImage model it returns the model untouched (a safety check, not a bug). The patch is installed on a cloned model via add_object_patch, so your original model isn't mutated and you can use the same base in multiple branches with different patches.
Honestly, this is the sharpest tool in the pack and also the most niche. For "just edit this photo," you don't need it - the plain encode path handles that. You reach for it when you want positional control: multi-reference compositions, product placement, character-into-scene work, where a reference placed at the wrong spot is worse than no reference at all.
Install
Part of lrzjason/ComfyUI-EditUtils. Install via ComfyUI Manager (search "ComfyUI-EditUtils") or git clone https://github.com/lrzjason/ComfyUI-EditUtils into custom_nodes, then restart. No pip deps. Works with QwenImage checkpoints - you still load those normally.
Troubleshooting
If offsets seem to do nothing, check the chain end-to-end: offsets must be set on the config/preparer, flow through the conditioning into the encoder, and this node must be on the patched model that actually samples. A common wiring mistake is patching a different branch of the model than the one that reaches the sampler. If ref_pos_match_target=true and references still land wrong, remember that mode overrides offsets entirely - it's "stretch to cover," not "place." And with debug_log=true, watch the console for the rope path logging to confirm the patch is actually firing.
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 | — |