Nodes/ComfyUI-FeiHou-Toolbox/多参图像手动拼接
ComfyUI Node

多参图像手动拼接

Drag your reference cutouts where you want them

By FX-FeiHou·Created 2 months ago·Updated 4 days ago· 127
多参图像手动拼接
  • model
  • clip
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • video_frame
  • collage
  • alpha_mask
promptperson
layout_json
width1280
height1280
detection_threshold0.50
background_opacity0.30
backgroundblack

Its sibling AutoRefCollage cuts people out of reference images with SAM3 and auto-composes them - fast, but it decides where everyone lands. ManualRefCollage is the same SAM3 pipeline with a control panel bolted on: each cutout lands on an editable canvas where you can drag, position, and scale it before the collage is rendered. If the auto layout overlaps your subjects or puts the wrong person on the wrong side of the frame, this is the node you reach for instead.

It's the more polished half of the pair, too - the changelog shows the author iterating on it hard across v2.0 through v2.2.2, fixing preview loading, bypass handling, and external width/height routing. It comes from the same single-maintainer pack (ComfyUI-FeiHou-Toolbox), same author as the wan2.2-Remix HuggingFace workflow.

How it works

Same SAM3 segmentation core as AutoRefCollage: model + clip from a CheckpointLoaderSimple pointed at a SAM3/SAM3.1 checkpoint (not your SDXL/Flux checkpoint), prompt as the detection phrase, up to five image_1..image_5 references. The difference is the frontend. The node's JS builds a canvas overlay, and a backend route (/feihou/manual_collage/load) generates SAM3 preview cutouts server-side so you can see the alpha edges before you run the workflow. When you're happy, the layout - position, scale, order of each cutout - is serialized into the layout_json widget and replayed during execution.

One extra trick: a video_frame input can sit behind the collage as a composition reference. background_opacity (default 0.3) blends that frame over the black/white background - handy when you're lining up subjects to match a scene before generation.

The inputs that matter

  • model / clip - SAM3 checkpoint and its CLIP, from CheckpointLoaderSimple.
  • prompt - short detection phrase, default person.
  • layout_json - the layout saved by the node UI. It's an internal field; you normally don't hand-edit it.
  • width / height - the canvas size. Here's the gotcha: since v2.2.2 these are only applied when you click the 应用尺寸 (Apply Size) button. The author deliberately stopped auto-applying linked width/height, so early reads don't fire before KJNodes Set_variable/Get_variable chains are ready. If you wire width/height externally and nothing changes, click the button.
  • detection_threshold - same SAM3 mask threshold as AutoRefCollage; lower keeps more edge detail.
  • background_opacity / background - video-frame blend and collage background color.
  • video_frame - optional background image to compose against.

Outputs: collage (IMAGE) and alpha_mask (MASK), same contract as the auto version.

Install

ComfyUI Manager (search ComfyUI-FeiHou-Toolbox) or:

cd ComfyUI/custom_nodes
git clone https://github.com/FX-FeiHou/ComfyUI-FeiHou-Toolbox

Restart ComfyUI and hard-refresh the browser - the canvas UI lives in the pack's JS, so a stale page means you'll see a bare node with no editor. No Python dependencies beyond what ComfyUI ships, but the pack needs a current ComfyUI build (it's written against the comfy_api.latest node API) and a SAM3 checkpoint on disk.

Common issues

  • Width/height ignored - you edited or wired them but the canvas didn't move. Click 应用尺寸. That's the intended behavior, not a bug.
  • No cutout previews - the preview route needs to resolve the upstream CheckpointLoaderSimple; if it can't, it errors out and you get an empty canvas. Check the checkpoint is actually connected.
  • Bypassed inputs sneak into the render - fixed in v2.1: ignored or bypassed images are now excluded from both the preview and execution. If you're on an old install, update the pack.
  • Missing SAM3 license - SAM3 ships under Meta's custom SAM License, not Apache; worth a glance at the terms before you build production workflows on it.
Categoryimage/compositing

Inputs (15)

NameTypeDefaultDescription
modelMODELSAM3/SAM3.1 model from CheckpointLoaderSimple.
clipCLIPSAM3/SAM3.1 CLIP from CheckpointLoaderSimple. The node encodes the prompt with this input.
promptSTRINGpersonText prompt used internally for SAM3 detection. Use a short object phrase, e.g. person or woman.
layout_jsonSTRINGInternal manual collage layout saved by the node UI.
widthINT128064–8192Output collage width.
heightINT128064–8192Output collage height.
detection_thresholdFLOAT0.500–1SAM3 mask threshold after segmentation. Lower values keep more edge/detail; higher values remove weak regions.
background_opacityFLOAT0.300–1Background video frame opacity mixed over the black/white collage background.
backgroundCOMBOblackBackground color for the RGB collage image output.
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
image_5optIMAGE
video_frameoptIMAGE

Outputs (2)

NameTypeDescription
collageIMAGE
alpha_maskMASK