Nodes/ComfyUI-Quick-Merge/🎨 Quick Merge
ComfyUI Node

🎨 Quick Merge

Quick Merge isn't quick, and it isn't a checkpoint merge β€” it's a one-node compositing factory

By stompy001Β·Created about a month agoΒ·Updated 18 days agoΒ· 1
🎨 Quick Merge
  • Background
  • Foreground (optional)
  • mask (optional)
  • composited_image
  • light_mask
  • relight_fg_crop
  • relight_bg_crop
β—„πŸ“ batch_processingfalseβ–Ί
β—„πŸ“ foreground_batchfalseβ–Ί
β—„πŸ“ fg_batch_folderπŸ“ Type or paste folder path here...β–Ί
β—„πŸ“ background_batchfalseβ–Ί
β—„πŸ“ bg_batch_folderπŸ“ Type or paste folder path here...β–Ί
β—„πŸ“ batch_pairing_modeβ–Ύβ–Ί
β—„πŸ“ batch_chunk_size4β–Ί
β—„πŸ“ initial_resizefalseβ–Ί
β—„πŸ“ fg_resize_modeCrop to Fill (Preserve Aspect)β–Ί
β—„πŸ“ fg_crop_aligncenterβ–Ί
β—„πŸ“ fg_initial_width720β–Ί
β—„πŸ“ fg_initial_height1280β–Ί
β—„πŸ“ bg_resize_modeCrop to Fill (Preserve Aspect)β–Ί
β—„πŸ“ bg_crop_aligncenterβ–Ί
β—„πŸ“ bg_initial_width1920β–Ί
β—„πŸ“ bg_initial_height1080β–Ί
β—„βœ‚οΈ merge_imagefalseβ–Ί
β—„βœ‚οΈ cutout_modelβ–Ύβ–Ί
β—„βœ‚οΈ auto-position (WiP)falseβ–Ί
β—„βœ‚οΈ foreground_size1.00β–Ί
β—„βœ‚οΈ foreground_left_right0β–Ί
β—„βœ‚οΈ foreground_up_down0β–Ί
β—„βœ‚οΈ flip_horizontalfalseβ–Ί
β—„βœ‚οΈ flip_verticalfalseβ–Ί
β—„βœ‚οΈ rotation_degrees0β–Ί
β—„βœ‚οΈ edge_shrink_grow0β–Ί
β—„βœ‚οΈ edge_softness0β–Ί
β—„βœ‚οΈ foreground_opacity1.00β–Ί
β—„βœ‚οΈ blend_modeβ–Ύβ–Ί
β—„βœ‚οΈ blend_strength1.00β–Ί
β—„βš‘ ai_upscalefalseβ–Ί
β—„βš‘ pipeline_orderβ–Ύβ–Ί
β—„βš‘ choose_upscale_modelβ–Ύβ–Ί
β—„βš‘ upscale_by2.00β–Ί
β—„βš‘ tile_size (0 means off/native)512β–Ί
β—„βš‘ post_upscale_edge_soften0β–Ί
β—„πŸŽ¨ colors_and_filtersfalseβ–Ί
β—„πŸŽ¨ filter_targetβ–Ύβ–Ί
β—„πŸŽ¨ filter_typeβ–Ύβ–Ί
β—„πŸŽ¨ filter_strength1.00β–Ί
β—„πŸŽ¨ brightness0.00β–Ί
β—„πŸŽ¨ contrast1.00β–Ί
β—„πŸŽ¨ saturation1.00β–Ί
β—„πŸŽ¨ filter_size3β–Ί
β—„πŸŽ¨ background_blur0β–Ί
β—„πŸŒ— shadowsfalseβ–Ί
β—„πŸŒ— shadow_color_hex#000000β–Ί
β—„πŸŒ— shadow_darkness0.50β–Ί
β—„πŸŒ— shadow_softness15β–Ί
β—„πŸŒ— shadow_position_x10β–Ί
β—„πŸŒ— shadow_position_y10β–Ί
β—„πŸŽ― target_resolutionfalseβ–Ί
β—„πŸŽ― target_resize_modeβ–Ύβ–Ί
β—„πŸŽ― target_crop_alignβ–Ύβ–Ί
β—„πŸŽ― target_width1920β–Ί
β—„πŸŽ― target_height1080β–Ί
β—„πŸ–ΌοΈ pixel_smoothingβ–Ύβ–Ί

If "merge" makes you think of checkpoint merging, forget that immediately. 🎨 Quick Merge (class QuickMergeNode) is the opposite thing: one giant node that pastes a foreground cutout onto a background, then optionally cuts it out, resizes it, repositions it, blends it, filters it, shadows it, upscales it, and does all of that across whole folders of images. The name is doing a lot of heavy lifting - "quick" and "merge" are the two least accurate words here. It's a single-node compositing factory.

You'd reach for this when a normal graph starts to feel like a plate of spaghetti. The usual product-shot pipeline - cut the subject out with BiRefNet, drop it on a background, scale and nudge it, drop a shadow, upscale - takes six or seven nodes in vanilla ComfyUI. This packs the chain behind one socket setup and, crucially, makes it batchable.

What it actually is

Three image inputs in, one composite out. Background is the required canvas. Foreground (optional) is what gets stamped on top, and mask (optional) feeds the light-pipeline (more on that below). Everything else is a toggle.

It's really four engines behind one face:

  • Cutout. Turn on βœ‚οΈ merge_image and pick βœ‚οΈ cutout_model - BiRefNet (lite, standard, HR), RMBG-1.4/2.0, or "None (Use Alpha)" if your foreground already has transparency. These are the real deal: the same BiRefNet weights the ecosystem standardised on for hair and fabric edges, loaded straight from HuggingFace via transformers. BiRefNet_lite is the sensible default; reach for BiRefNet_HR above ~1500px so the model doesn't downscale your edges internally.
  • Placement. βœ‚οΈ foreground_size, βœ‚οΈ foreground_left_right, βœ‚οΈ foreground_up_down do exactly what they say, plus flips, rotation, edge shrink/feather, opacity, and a handful of blend modes. The one you'll actually touch first is foreground_size - 1.0 means "fit the foreground onto the background canvas."
  • AI upscale. ⚑ ai_upscale runs a RealESRGAN_x2plus model through spandrel, with upscale_by for the factor and tile_size (0 = whole image, 512 default) to keep VRAM sane.
  • Batch. πŸ“ batch_processing with folder paths (more below), pairing either 1-to-1 sequentially or cross-multiplying every foreground with every background.

The four outputs are composited_image (the one you care about), light_mask, and relight_fg_crop / relight_bg_crop. The last three serve a relighting pass downstream: light_mask is your cutout or input mask, blurred into a soft gradient you can feed an IC-Light-style node. If you just want a picture, wire composited_image to a Save Image and ignore the rest.

How it survives big batches

The trick that makes folders possible is chunking and VRAM isolation. batch_chunk_size (default 4) caps how many frames go through the heavy pipeline at once, and the loader normalises every file - a 3-channel .jpg and a 4-channel .png mixed in the same run - into uniform RGBA float32 tensors before the compositor sees them. It clears the CUDA cache between chunks, which is why the README can promise BiRefNet over massive batches without OOM. One gotcha hidden in the source: batch folder paths are relative to your ComfyUI/input directory, not arbitrary filesystem paths. The author patched a path-traversal hole in there, so don't fight it - drop your folders under ComfyUI/input/ and reference them by name.

Install

ComfyUI Manager β†’ search ComfyUI-Quick-Merge (or "Quick Merge"), or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/stompy001/ComfyUI-Quick-Merge

Restart ComfyUI. Dependencies are transformers, torchvision, and spandrel - the node tries to auto-install the first three on first import. The heavier cost is model downloads: the cutout weights pull from HuggingFace the first time you run a cutout, and the first upscale downloads RealESRGAN_x2plus.pth from GitHub releases. First runs are slow; subsequent ones cache.

Where people get burned

The README's own warnings are the real ones, not invented friction:

  • VRAM. ⚑ ai_upscale above 2.0Γ— over a big batch will happily eat your graphics memory. Keep batch_chunk_size at 1–4 when upscaling. The tooltip says "0 = no limit" but the field's minimum is 1 - treat 1 as the floor, not a suggestion.
  • Aspect ratio parity. Studio backgrounds with a podium or table must all be the same resolution and aspect ratio in a folder batch, or the pedestal coordinates drift between frames and your product lands off-target. This is a real constraint, not a warning for show.
  • Don't touch auto-position. The auto-position (WiP) toggle is locked down mid-refactor; the node forces it off anyway. Leave it alone.
  • First run looks frozen while a segmentation model downloads. It's not dead, it's fetching ~600MB of BiRefNet weights over your connection.

Is it the node for a one-off composite? Overkill - the vanilla image nodes do that in three clicks. It earns its keep when you're stamping a hundred product shots onto a hundred backgrounds without babysitting. That's the workflow this was built for.

Categoryimage/compositing

Inputs (60)

NameTypeDefaultDescription
BackgroundoptIMAGEβ€”
Foreground (optional)optIMAGEβ€”
mask (optional)optMASKβ€”
πŸ“ batch_processingoptBOOLEANfalseCRITICAL: Ensure all images processed in a folder batch share identical resolutions and aspect ratios to prevent platform layout shifts.
πŸ“ foreground_batchoptBOOLEANfalseβ€”
πŸ“ fg_batch_folderoptSTRINGπŸ“ Type or paste folder path here...β€”
πŸ“ background_batchoptBOOLEANfalseβ€”
πŸ“ bg_batch_folderoptSTRINGπŸ“ Type or paste folder path here...β€”
πŸ“ batch_pairing_modeoptCOMBO2 options: 1-to-1 Match (Sequential), Cross-Multiply (All Combinations)
πŸ“ batch_chunk_sizeoptINT41–128Max images processed at once through the heavy pipeline. 0 = no limit.
πŸ“ initial_resizeoptBOOLEANfalseβ€”
πŸ“ fg_resize_modeoptCOMBOCrop to Fill (Preserve Aspect)4 options: Crop to Fill (Preserve Aspect), Stretch to Fit, Fit Inside (Letterbox), Fit Inside (Pad with Blur)
πŸ“ fg_crop_alignoptCOMBOcenter5 options: center, top, bottom, left, right
πŸ“ fg_initial_widthoptINT7208–16384β€”
πŸ“ fg_initial_heightoptINT12808–16384β€”
πŸ“ bg_resize_modeoptCOMBOCrop to Fill (Preserve Aspect)4 options: Crop to Fill (Preserve Aspect), Stretch to Fit, Fit Inside (Letterbox), Fit Inside (Pad with Blur)
πŸ“ bg_crop_alignoptCOMBOcenter5 options: center, top, bottom, left, right
πŸ“ bg_initial_widthoptINT19208–16384β€”
πŸ“ bg_initial_heightoptINT10808–16384β€”
βœ‚οΈ merge_imageoptBOOLEANfalseβ€”
βœ‚οΈ cutout_modeloptCOMBO6 options: BiRefNet_lite (Fast/Accurate), RMBG-2.0 (New/Accurate), RMBG-1.4 (Fast), BiRefNet (High Quality), BiRefNet_HR (4K/8K High Quality), None (Use Alpha)
βœ‚οΈ auto-position (WiP)optBOOLEANfalseβ€”
βœ‚οΈ foreground_sizeoptFLOAT1.000.01–100β€”
βœ‚οΈ foreground_left_rightoptINT0-8192–8192β€”
βœ‚οΈ foreground_up_downoptINT0-8192–8192β€”
βœ‚οΈ flip_horizontaloptBOOLEANfalseβ€”
βœ‚οΈ flip_verticaloptBOOLEANfalseβ€”
βœ‚οΈ rotation_degreesoptINT0-360–360β€”
βœ‚οΈ edge_shrink_growoptINT0-100–100β€”
βœ‚οΈ edge_softnessoptINT00–255β€”
βœ‚οΈ foreground_opacityoptFLOAT1.000–1β€”
βœ‚οΈ blend_modeoptCOMBO5 options: Normal, Multiply, Screen, Overlay, Soft Light
βœ‚οΈ blend_strengthoptFLOAT1.000–1β€”
⚑ ai_upscaleoptBOOLEANfalseβ€”
⚑ pipeline_orderoptCOMBO3 options: upscale composite, upscale foreground only, upscale background only
⚑ choose_upscale_modeloptCOMBO1 options: RealESRGAN_x2plus.pth (Auto-Download)
⚑ upscale_byoptFLOAT2.000.25–32β€”
⚑ tile_size (0 means off/native)optINT5120–8192β€”
⚑ post_upscale_edge_softenoptINT00–255β€”
🎨 colors_and_filtersoptBOOLEANfalseβ€”
🎨 filter_targetoptCOMBO3 options: Foreground, Background, Both
🎨 filter_typeoptCOMBO7 options: Gaussian Blur, Auto-Color Match, Laplacian Sharpen, Edge Detect, Sepia, Invert, +1
🎨 filter_strengthoptFLOAT1.000–10β€”
🎨 brightnessoptFLOAT0.00-2–2β€”
🎨 contrastoptFLOAT1.000–5β€”
🎨 saturationoptFLOAT1.000–5β€”
🎨 filter_sizeoptINT31–127β€”
🎨 background_bluroptINT00–255β€”
πŸŒ— shadowsoptBOOLEANfalseβ€”
πŸŒ— shadow_color_hexoptSTRING#000000β€”
πŸŒ— shadow_darknessoptFLOAT0.500–1β€”
πŸŒ— shadow_softnessoptINT151–255β€”
πŸŒ— shadow_position_xoptINT10-1000–1000β€”
πŸŒ— shadow_position_yoptINT10-1000–1000β€”
🎯 target_resolutionoptBOOLEANfalseβ€”
🎯 target_resize_modeoptCOMBO4 options: Crop to Fill (Preserve Aspect), Stretch to Fit, Fit Inside (Letterbox), Fit Inside (Pad with Blur)
🎯 target_crop_alignoptCOMBO5 options: center, top, bottom, left, right
🎯 target_widthoptINT192064–16384β€”
🎯 target_heightoptINT108064–16384β€”
πŸ–ΌοΈ pixel_smoothingoptCOMBO4 options: bicubic, lanczos, bilinear, nearest

Outputs (4)

NameTypeDescription
composited_imageIMAGEβ€”
light_maskMASKβ€”
relight_fg_cropIMAGEβ€”
relight_bg_cropIMAGEβ€”