Nodes/comfyui-moonpack/Reference Concat
ComfyUI Node

Reference Concat

Concatenates a batch of reference images into a strip alongside a main image, for feeding identity references to video models without losing subject identity. The strip is placed on the main image's longest side, sized to exactly match that side's length (no resolution cap), and the main image is never shrunk. 'offset' slides the strip further into the main image (overlap) or further outside it (gap). If main_image is left unconnected, outputs a contact-sheet grid of just the reference images instead (side/ref_scale/offset are ignored in that mode). Accepts either a MoonPack Image List (keeps each reference's native resolution) or a plain stacked IMAGE batch.

By moonwhaler·Created about a year ago·Updated 4 days ago· 15
Reference Concat
  • reference_images
  • main_image
  • image
  • mask
sidetop
ref_scale0.50
offset0
fillblack
interpolationbicubic
max_ref_side0
invert_maskfalse
CategoryMoonPack/image

Inputs (9)

NameTypeDefaultDescription
reference_imagesIMAGEReference images to concatenate. Connect a MoonPack Image List to keep each image's native resolution (recommended for mixed-resolution references), or a plain stacked IMAGE batch.
sideCOMBOtopWhich side of the main image the strip goes on. The strip's row-vs-column layout is auto-picked from the main image's longest side; 'top'/'left' place the strip before the main image along that axis, 'bottom'/'right' place it after. Ignored if main_image is unconnected.
ref_scaleFLOAT0.500.01–4Strip thickness as a fraction of the main image's cross-side. The main image's long side is a cap: the strip is only scaled down (never stretched) if it would overflow. Ignored if main_image is unconnected.
offsetINT0-8192–8192Positive: slide the strip into the main image, covering that many pixels of it. Negative: pull the strip away from the main image, leaving a filled gap. Clamped so the main image is never cropped or shrunk. Ignored if main_image is unconnected.
fillCOMBOblackBackground color for any gap/leftover space. 'edge_average' samples the main image's edge nearest the strip, or the average of all references when main_image is unconnected.
interpolationCOMBObicubicResampling filter used whenever a reference image is resized, including upscaling references smaller than the target size.
max_ref_sideINT00–8192Caps each reference's longest side to this many pixels before any other processing (downscale only, never upscales). Keeps one oversized reference from blowing up the contact-sheet or strip size. 0 = no cap.
invert_maskBOOLEANfalseFlip the output mask (main-image/empty-cell area becomes 1.0 instead of the reference area).
main_imageoptIMAGEMain / first-frame image. If a batch is passed, only the first frame is used. Leave unconnected to instead output a contact-sheet grid of the reference images.

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK