ComfyUI-EditUtils
A collection of utility nodes for advanced image editing in ComfyUI, supporting multiple AI models including Qwen and Flux2Klein.
Nodes (37)
Let the Image Tell You
The Converter Node That Just Lets a Wire Be a Wire
Wrap a Loose Latent Tensor Into Something a Sampler Will Accept
How to Feed Boogu More Than Three Reference Images
Repositioning References Without Regenerating
Prompt, Refs, and a Built-In Negative in One Node
The One-Line Handshake That Tells EditUtils You're Running Boogu
Unpacking Boogu's Black Box Into Wires You Can Actually Use
Keep Your Reference Images From Leaking Into the Wrong Wire
Drive Your Reference Settings From a JSON String Instead of Twenty Widgets
Deliver Edits at the Original Size, Not With Black Bars
Find Exactly What Changed Between Two Images — Without a Naive Pixel Diff
The One Encode Node to Rule All the Edit Models in This Pack
Unlimited Reference Images for Klein, One Chained Config at a Time
Move References Around the Canvas
Prompt, Up to Three Refs, Done
The Tiny Config Node That Picks Flux 2 Klein's Side of the Pipeline
Turn Klein's Encode Black Box Into Eight Usable Wires
The Node That Turns Krea 2 Into an Instruction Editor
The Config Node That Sneaks Krea 2 Through the Qwen Pipeline
Grab one thing out of a LIST — that's the whole job
Reload a saved conditioning without re-encoding
Same cache loader, but organized by LoRA name instead of by file
Stock LoadImage, plus a filename output — so you can actually do something with it
Resize-and-pad your reference the way EditUtils does — without burning a CLIP encode
One config node to rule the model switcher — until you switch to Flux2Klein
One image, one config block — chain these to feed unlimited references
The encode node's kitchen sink, unpacked into 11 usable wires
The one-node Qwen edit encode — three images, one wire in, sampler-ready out
One Ticket Per Reference Image
Putting a Reference Where You Want It
Three Reference Images, One Node
The Tiny Node That Decides You're on the Qwen-Image 2.1 Path
Put each reference exactly where you want it — ROPE-positioned regional editing
The Qwen config node that can't be misconfigured — fixed name, fixed VAE unit
Paint where the reference goes — a mask becomes your regional-edit coordinates
Stop re-encoding the same image every run — save the condition once
ComfyUI-EditUtils
A collection of utility nodes for advanced image editing in ComfyUI, supporting multiple AI models including Qwen, Qwen-Image 2.1, Flux2Klein and Krea2.
Update
20260929 Added Configurable Pad Mode/Color/Noise (pad_mode, pad_color, pad_noise), White Edge Default For Qwen 1.0 / Qwen-Image 2.1 To Reduce Black Edge Amplification 20260920 Added Qwen-Image 2.1 support (QwenImage21ModelConfig / QwenImage21ConfigPreparer / QwenImage21EditTextEncode / QwenImage21EditApply). 64ch 16x VAE, Qwen3-VL text encoder, vision-slot latent splicing and per-reference ROPE offsets. Example workflow: edit utils qwen image 2.1 example.json. Requires ComfyUI with upstream Qwen-Image 2.1 support. 20260504 Added Longest Edge Image Process, Clear Ref Latents, Save/Load Condition nodes. Fixed no_refs_cond output in Output Extractors. 20260407 Fixed Extra Height Unit Pad Which Introduce Color Shift
Overview
ComfyUI-EditUtils is the follow-up version of ComfyUI-QwenEditUtils, offering enhanced capabilities for image editing workflows with support for multiple AI models. This package provides a comprehensive set of tools for advanced image editing, featuring flexible configuration options and model-specific optimizations.
Examples
RunningHub Single Image Workflow: https://www.runninghub.ai/post/2045207600739913729/?inviteCode=rh-v1279
RunningHub Simple Krea2 Depth Workflow (工作流:Simple Krea Depth): https://www.runninghub.ai/post/2082077636234313729/?inviteCode=rh-v1279
Usage Tips
For better consistency in local editing, it's recommended to use this workflow with Consistency Edit LoRA:
- Civitai Download: Consistency Edit LoRA
- Huggingface Download: Consistency Edit LoRA
Qwen-Image 2.1
EditUtils supports Qwen-Image 2.1 editing with up to 3 references in the simple path (unlimited via the config chain). Qwen-Image 2.1 works differently from Qwen-Image 1.0, and the qwen21 nodes handle the differences for you:
- Qwen3-VL text encoder: prompt and reference images are encoded together; each reference latent is spliced into the text sequence at the encoder's vision slots (
image_slots) — noPicture n:prompt prefix needed. - New VAE: 64-channel latents with 16x spatial downscale (RGBA-aware). References are aligned to 16-pixel multiples, matching the VAE downscale.
- Unified reference resize: the vision tower and the VAE consume the same resized image (alpha composited over white for the encoder, full RGBA for the VAE), so there is no separate
vl_target_sizepipeline.

Result produced with edit utils qwen image 2.1 example.json.
Nodes:
| Node | Purpose |
|---|---|
| QwenImage21ModelConfig_EditUtils | Model config (qwen_image21 route, vae_unit=16). Empty instruction = built-in T2I template; custom instruction = custom system prompt. |
| QwenImage21ConfigPreparer_EditUtils | Per-image config: to_ref, ref_main_image, ref_longest_edge (16-aligned), ref_crop, mask, rope_x_offset / rope_y_offset. Chain multiple nodes for multiple references. |
| QwenImage21EditTextEncode_EditUtils | One-node simple path (image1–3), same outputs as EditTextEncode_EditUtils. |
| QwenImage21EditApply_EditUtils | Optional model patch enabling per-reference ROPE offsets (regional editing). Connect only the model wire — offsets flow through the conditioning chain. |
Wiring (see edit utils qwen image 2.1 example.json):
UNETLoader (qwen_image_2.1) ──► [QwenImage21EditApply] ──► KSampler ──► VAEDecode ──► CropWithPadInfo ──► SaveImage
CLIPLoader (type qwen_image) ─┐
VAELoader (qwen_image_2.1_vae) ┤
LoadImage ──► QwenImage21ConfigPreparer ─┐
QwenImage21ModelConfig ──────────────────┴──► EditTextEncode_EditUtils ──► KSampler
QwenImage21EditApply_EditUtils is optional — add it between UNETLoader and KSampler only when you want rope_x_offset / rope_y_offset regional control.
Notes:
- Requires a ComfyUI build with upstream Qwen-Image 2.1 support (the
qwen_image21model); on older builds the model won't load and the EditApply node passes the model through unchanged. - The main image's padded latent is the sampling start latent; use
pad_info → CropWithPadInfo_EditUtilsafter decode to get the unpadded result (same flow as the Qwen 1.0 path). rope_x_offset / rope_y_offsetonly take effect withQwenImage21EditApply_EditUtilsin the graph; with all offsets at zero the model runs its native path (prefix KV cache unaffected).- Keep
to_vlenabled on the Config Preparer — disabling it splices the reference after the text sequence, which is an untrained path. - Suggested starting point (as in the example workflow): Euler / Simple, 25 steps, CFG 1.0.
Workflows
Example workflows are available in the workflows directory:
- edit utils qwen image 2.1 example.json - Qwen-Image 2.1 editing workflow (single reference). Loads the model with
UNETLoader+CLIPLoader(typeqwen_image) +VAELoader, then wiresLoadImage → QwenImage21ConfigPreparer_EditUtils → EditTextEncode_EditUtils ← QwenImage21ModelConfig_EditUtils → KSampler → VAEDecode → CropWithPadInfo_EditUtilsto undo the main-image padding.- The reference latent is spliced into the text sequence at the vision slots (
image_slots); the 2.1 VAE is 64-channel with 16x spatial downscale, so references align to 16-pixel multiples. rope_x_offset / rope_y_offseton the Config Preparer shift a reference's position on the canvas when the model is patched withQwenImage21EditApply_EditUtils(regional editing) — the example workflow does not include that node.- Sampler settings in the example:
euler / simple, 25 steps, CFG 1.0. Requires ComfyUI with upstream Qwen-Image 2.1 support.
- The reference latent is spliced into the text sequence at the vision slots (
- Simple Krea2 Depth.json - Simple Krea2 editing workflow with a depth LoRA. Wires
LoadImage → Krea2ModelConfig_EditUtils → EditTextEncode_EditUtils → Krea2EditApply_EditUtils → KSampler, loading the model viaUNETLoader + LoraLoaderModelOnly— the reference latent flows through the conditioning chain automatically.- Online version on RunningHub: https://www.runninghub.ai/post/2082077636234313729/?inviteCode=rh-v1279
- Depth LoRA download: Krea2 Depth LoRA (Civitai)
⚠️ Note: Krea2 edit support is still in development — node interfaces and behavior may change.
Capabilities
- EditUtils supports direct high-resolution editing without pixel shifts, up to 2xxx ~ 3xxx resolution
- Multiple images input support:
- Simple workflow: up to 3 images
- Single and multiple workflows: unlimited images (connect multiple configs)
Pad Edge Control
When ref_crop is set to pad, the image is padded to a multiple of the VAE unit size. How that padding looks is now configurable per image through pad_mode, pad_color, pad_color_rgb and pad_noise on the config preparer nodes (QwenConfigPreparer_EditUtils / QwenImage21ConfigPreparer_EditUtils / Flux2KleinConfigPreparer_EditUtils), the ConfigJsonParser_EditUtils JSON, or the standalone LongestEdgeImageProcess_EditUtils node:
- pad_mode (default:
color):color: solid fill usingpad_coloredge: replicate the outermost pixel row/columnmirror: reflect the content at the boundaryborder_mean: fill each side with the mean of its nearest 8 pixels
- pad_color (default:
whitefor Qwen and Qwen-Image 2.1,blackfor Flux2Klein and standaloneLongestEdgeImageProcess_EditUtils): dropdown withred,green,blue,white,black,custom. - pad_color_rgb (default:
-): optional override, a 6-digit hex color,#optional (e.g.FF0000or#FF0000). When it holds a valid hex it overridespad_color, whatever the dropdown says. Anything else (-, wrong length, non-hex characters, plain numbers,r,g,b) is invalid and has no effect, so the dropdown value applies.customcarries no color of its own, so with an invalid hex it falls back to the model default. - pad_noise (default:
0.0): Gaussian jitter (std) added to the padding area only — the image content is never modified. 0.02-0.05 is recommended with solid colors.
Why this exists: Qwen models (1.0 and Image 2.1) were trained with black pads, so black padding tends to get amplified into large black edges during generation. White is therefore the default for both Qwen paths. If a solid color is still not enough, border_mean or mirror are content-adaptive alternatives, and any mode benefits from a small pad_noise.
The mask/semantics of the padded area are unchanged (it is always masked out), and CropWithPadInfo_EditUtils still crops the padding away correctly.
Node Categories
Documentation:
Key Features
- Multi-Model Support: Works with Qwen, Qwen-Image 2.1, Flux2Klein, Boogu and Krea2 models for versatile image editing
- Flexible Configuration: Per-image configuration options for reference and VL processing
- Pad Edge Control: Configurable pad mode/color/noise (white edge default for Qwen 1.0 and Qwen-Image 2.1) to avoid black edge amplification
- Unified Interface: Single node EditTextEncode_EditUtils works with multiple models through configuration nodes
- Advanced Processing: Supports complex image editing workflows with multiple reference images
- Comprehensive Output: Detailed output dictionary with all processing intermediates
- Modular Design: Separated configuration, processing, and extraction nodes for maximum flexibility
New Nodes
LongestEdgeImageProcess_EditUtils
A utility node that resizes and pads an image based on a target longest edge, using the same processing logic as EditTextEncode. Useful when you need the image preprocessing without CLIP/VAE encoding.
Inputs:
image: Input imageref_longest_edge: Target longest edge size (default: 1024)ref_crop: Crop method - "pad", "center", or "disabled" (default: "pad")ref_upscale: Upscale method (default: "lanczos")vae_unit: VAE unit size for padding alignment (default: 8)pad_mode(optional): Padding fill mode - "color", "edge", "mirror", or "border_mean" (default: "color")pad_color(optional): Dropdown - "red", "green", "blue", "white", "black", or "custom" (default: "black"; use "white" for Qwen models)pad_color_rgb(optional): Override as 6-digit hex, "#" optional (e.g. "FF0000" or "#FF0000"); overridespad_colorwhen valid (default: "-" = no effect)pad_noise(optional): Gaussian jitter (std) added to the padding only (default: 0.0, try 0.02-0.05)
Outputs:
processed_image: The resized/padded imagepad_info: Padding information dictionaryscale_by: The scale factor
Use Case: Pre-process images with longest edge scaling before passing to other nodes, or reuse the same image processing pipeline outside of the encoding workflow.
ClearRefLatents_EditUtils
A utility node that strips reference latents from a conditioning, outputting a clean conditioning without any ref latents attached.
Inputs:
conditioning: Conditioning with reference latents
Outputs:
conditioning: The same conditioning with reference latents cleared
Use Case: Remove reference latents from conditioning when you want to use the text encoding without image references.
SaveCondition_EditUtils
Saves a conditioning tensor to a .ckpt file in the models/conditions directory.
Inputs:
condition: The conditioning to savefilename: Output filename (default: "condition_tensor")
Use Case: Persist conditioning tensors for later reuse without re-encoding.
LoadCondition_EditUtils
Loads a conditioning tensor from a .ckpt file in the models/conditions directory.
Inputs:
filename: Select from available.ckptfiles in the conditions directory
Outputs:
conditioning: The loaded conditioning tensor
Use Case: Reuse previously saved conditioning tensors in new workflows.
LoadConditionFromLoras_EditUtils
Lists files from the loras directory and attempts to load matching .ckpt files from the conditions directory.
Inputs:
filename: Select from available lora files
Outputs:
conditioning: The loaded conditioning tensor
DiffMask_EditUtils
A utility node that generates a mask highlighting the differences between two images. Useful for editing tasks where you want to identify changed regions.
Inputs:
image1: First imageimage2: Second imagethreshold: Threshold to ignore minor differences (0.0-1.0, default: 0.05)
Output:
mask: A mask highlighting differences between the two images
Use Case: Compare original and edited images to create a mask for selective editing or inpainting.
Installation
- Clone or download this repository into your ComfyUI's
custom_nodesdirectory. - Restart ComfyUI.
- The nodes will be available in the "advanced/conditioning" category.
Changelog
ComfyUI-EditUtils vs ComfyUI-QwenEditUtils
ComfyUI-EditUtils is the follow-up version of ComfyUI-QwenEditUtils with the following improvements:
- Multi-model support (Qwen, Qwen-Image 2.1, Flux2Klein, Boogu and Krea2)
- Unified node architecture with configuration nodes
- Enhanced flexibility and modularity
- Improved code organization and maintainability
Contact
- Twitter: @Lrzjason
- Email: [email protected]
- QQ Group: 866612947
- Wechatid: fkdeai
- Civitai: xiaozhijason