EditUtils: Qwen Config Preparer lrzjason
One image, one config block — chain these to feed unlimited references
- image
- configs
- mask
- configs
- config
This is the node that makes multi-reference editing work in EditUtils. QwenConfigPreparer_EditUtils takes one image and turns it into a config block describing how that image should be treated - whether it goes into the reference latent, into the Qwen2.5-VL text-encoder vision stream, which one is the "main" image, at what resolution, with what cropping. Then it appends that block to a configs list and passes the list on. Chain a few of these together, one per image, and EditTextEncode_EditUtils receives a list of however many references you want - the README's "unlimited images" claim, with the caveat that your VRAM will object before the node does.
Mechanically each config is a Python dict with a fixed set of keys, and every one maps to a real widget:
to_ref- put this image into the reference latent (the appearance/identity stream that the sampler uses). Default on.ref_main_image- mark this as the image. Its latent becomes the outputlatentthat seeds sampling, and it's the one that generatespad_info. Default on for the first node in the chain; only one image can be main, and the pack force-flips later ones off.ref_longest_edge(default 1024),ref_crop(pad/center/disabled),ref_upscale(lanczos/bicubic/area) - the resize-and-align treatment, same logic asLongestEdgeImageProcess_EditUtils.padpads to the VAE unit with black, which is what keeps high-res refs (2xxx–3xxx) clean.to_vl- also feed this image to Qwen2.5-VL, the vision-language encoder that gives the model semantic understanding of what's in the picture. This is a separate stream from the VAE latent.vl_resize,vl_target_size(default 384),vl_crop,vl_upscale- how to shrink the image before it hits the VL encoder (VL is fed small; it reads meaning, not pixels).mask- optional, applies only to this image's reference latent (if its size doesn't match the image, it's dropped with a console warning).ref_resize_mode-longest_edge(longest dimension =ref_longest_edge) vsarea(total pixels =ref_longest_edge²).rope_x_offset/rope_y_offset- ROPE position offsets, mostly a Krea2 regional-editing feature; only effective whenref_pos_match_target=Falseon the apply node.
Outputs: configs (the accumulated LIST, wire it onward or into the encode node) and config (the just-created block for this image, handy for debugging or feeding a single-image encoder).
Where people get burned: thinking to_ref and to_vl are redundant. They're two different streams doing two different jobs - the VAE latent drives low-level appearance (keep this dress, this pose), the VL stream drives semantic understanding (this is a person sitting on a bench). Turn to_vl off and the model still sees the reference as pixels but understands much less about it; turn to_ref off and it understands but has no pixel-level anchor. For a normal edit, both on is right.
Install
Part of lrzjason/ComfyUI-EditUtils. Install via ComfyUI Manager (search "ComfyUI-EditUtils") or cd ComfyUI/custom_nodes && git clone https://github.com/lrzjason/ComfyUI-EditUtils, then restart. No pip deps.
Troubleshooting
If a config silently ignores your mask, check the mask dimensions match the image - mismatches are dropped with a console print, not an error. If the wrong image is driving the output latent, you've got ref_main_image on more than one node; the pack forces only the first to be main, so reorder or untick. And the "unlimited images" pitch has a real ceiling: every reference costs VAE encode time and sampler memory, and the Qwen-Image-Edit family is 20B - start with two refs, add more only when the VRAM gods permit.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| configsopt | LIST | Configs list | |
| to_refopt | BOOLEAN | true | Add image to reference latent |
| ref_main_imageopt | BOOLEAN | true | Set image as main image which would return the latent as output. |
| ref_longest_edgeopt | INT | 10248–4096 | Longest edge of the output latent |
| ref_cropopt | COMBO | pad | Crop method for reference image |
| ref_upscaleopt | COMBO | lanczos | Upscale method for reference image |
| to_vlopt | BOOLEAN | true | Add image to qwenvl 2.5 encode |
| vl_resizeopt | BOOLEAN | true | Resize image before qwenvl 2.5 encode |
| vl_target_sizeopt | INT | 384384–2048 | Target size of the qwenvl 2.5 encode |
| vl_cropopt | COMBO | center | Crop method for reference image |
| vl_upscaleopt | COMBO | lanczos | Upscale method for reference image |
| maskopt | MASK | — | |
| ref_resize_modeopt | COMBO | longest_edge | longest_edge: scale so the longest dimension equals ref_longest_edge. area: scale so total pixels equals ref_longest_edge squared. |
| rope_x_offsetopt | INT | 00–4096 | ROPE horizontal position offset in pixels (VAE-aligned, step=8). Shifts reference position IDs rightward on the canvas. Only effective with Krea2 when ref_pos_match_target=False. |
| rope_y_offsetopt | INT | 00–4096 | ROPE vertical position offset in pixels (VAE-aligned, step=8). Shifts reference position IDs downward on the canvas. Only effective with Krea2 when ref_pos_match_target=False. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| configs | LIST | — |
| config | ANY | — |