Nodes/ComfyUI_Element_easy/Smart merge images
ComfyUI Node

Smart merge images

The node that fixes pixel drift when Qwen-Edit or Klein edits your image

By supElement·Created 9 months ago·Updated about 11 hours ago· 10
Smart merge images
  • original_image
  • edited_crop_B
  • original_crop_A
  • Merged_Image
match_method
warp_method
optical_flow
color_match
feather_kernel20
adapt_thresh25
adapt_local_match
merge_mode
use_gputrue
force_recomputefalse

Smart merge images is the flagship node of this pack, and it exists to solve a very 2026 problem: instruction editors like Qwen-Image-Edit and Flux 2 Klein don't patch your image - they re-emit the whole frame. Pixels you didn't ask to change come back slightly shifted, and the colors drift. So when you crop a region, edit it, and try to stitch it back onto the original, it doesn't line up. This node does the stitching for you: it finds the shared features between the edited crop and the original, warps them back into alignment, matches the color, and merges them into a seam-free result.

How it works

You feed it two images: original_image and edited_crop_B (the edited region to merge back). The node finds matching features between them, computes the transform that re-aligns the edit to the original, and blends. There's also an optional original_crop_A input - and the README's advice is worth taking: for the most reliable merge, use all three, where original_crop_A is the unmodified crop from the original image. That third input gives the matcher a clean reference and dramatically improves alignment.

The knobs are split into stages:

  • match_method - how features are found: SIFT (OpenCV) (fast, classic), or DISK + LightGlue / SIFT + LightGlue (learned matching, more robust).
  • warp_method - how the edit is realigned: Homography (affine-ish plane warp), Homography + Optical Flow, or pure Optical Flow for handling more complex distortion.
  • optical_flow - which flow estimator to use when flow is involved: Farneback, DIS, or RAFT-Small/RAFT-Large (the bigger, the more accurate, the slower).
  • color_match - nine modes including Histogram, LAB_Mean, SeamlessClone (PS Auto Blend), Laplacian Pyramid Blend, and the pack's own Adaptive Local (strong), which is specifically tuned to repair the color shift from editing models. This one has two companion knobs: adapt_thresh (color difference threshold) and adapt_local_match (which local matching flavor the adaptive mask fusion uses).
  • feather_kernel (0–256) - softness of the merge seam. merge_mode - One to One merges a single pair; All to One handles the tiled case.

use_gpu toggles GPU acceleration (default on - flip it off if you're getting VRAM pressure or crash-on-driver weirdness), and force_recompute re-runs the feature matching instead of reusing a cached result, which you'll want after changing inputs.

Tiled merging

v1.4.7 added support for merging multiple crops in one go: edited_crop_B can take a batch of crop images and the node returns a single fully merged Merged_Image. The catch, stated plainly in the README: the input must be a batch, not a list. If you're feeding it from a list-producing node, convert it first with an Image List To Batch node or it won't work.

The model download you should know about

Some of the advanced matching/color options need model files. They're optional - if you don't use those options, nothing downloads. When you do, the node auto-downloads them to ComfyUI/models/elementEasy on first run. If you'd rather pre-stage them (or you're offline), copy the elementEasy folder from the pack's models directory into that same path and it'll skip the download.

Installing it

It ships in supElement/ComfyUI_Element_easy:

cd ComfyUI/custom_nodes
git clone https://github.com/supElement/ComfyUI_Element_easy.git

Restart ComfyUI, or install via ComfyUI Manager by searching ComfyUI_Element_easy. This is the one node in the pack with real dependencies - OpenCV at minimum, plus the matching/flow machinery for the advanced modes - so expect the first run to be heavier than the rest of the pack.

Gotchas

The "batch not list" rule for tiled merging is the number one tripwire. After that: the merge only works when the images actually share enough common features - if the edit changed too much (completely new content, no overlap), there's nothing to align and the result will be rough. Start with SIFT (OpenCV) for speed and only escalate to LightGlue/RAFT when alignment is bad. And the Adaptive Local (strong) color mode is specifically the fix for Qwen-Edit-style color shift - if that's your problem, use it rather than the generic modes.

CategoryElement_easy/image

Inputs (13)

NameTypeDefaultDescription
original_imageIMAGE
edited_crop_BIMAGE
match_methodCOMBO3 options: DISK + LightGlue, SIFT + LightGlue, SIFT (OpenCV)
warp_methodCOMBO3 options: Homography, Homography + Optical Flow, Optical Flow
optical_flowCOMBO4 options: Farneback, DIS, RAFT-Small, RAFT-Large
color_matchCOMBO9 options: Patch_based_color, Boundary-Aware Color, Laplacian Pyramid Blend, SeamlessClone (PS Auto Blend), Adaptive Local (strong), Histogram, +3
feather_kernelINT200–256
adapt_threshINT250–255
adapt_local_matchCOMBO5 options: Histogram, LAB_Mean, Reinhard, Adaptive Histogram, None
merge_modeCOMBO2 options: All to One, One to One
use_gpuBOOLEANtrue
force_recomputeBOOLEANfalse
original_crop_AoptIMAGE

Outputs (1)

NameTypeDescription
Merged_ImageIMAGE