ComfyUI Node

萌宝AI·智能拼图

Up to 20 images, no gutters, no stretched faces

By Corkery520·Created 3 days ago·Updated 3 days ago· 0
萌宝AI·智能拼图
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image_10
  • image_11
  • image_12
  • image_13
  • image_14
  • image_15
  • image_16
  • image_17
  • image_18
  • image_19
  • image_20
  • image

Stitching images together in ComfyUI usually means an image-composite node, a canvas size you compute by hand, and a debugging session when the third image has a different height. MengBaoSmartCollage (萌宝AI·智能拼图) skips all of that: connect images, get one assembled sheet back. Aspect ratios are preserved, there are no gaps, and the layout figure is worked out for you.

How the layout decides itself

The interface gives you numbered image ports - four to start, expandable up to twenty, which matches the pack's one-to-twenty claim. Order comes from the port number, not from the order you happened to wire things, so reloading a workflow can't silently shuffle your collage.

The arrangement is a square-ish grid: the column count is floor(sqrt(n)). Four images become a 2x2. Five to eight become two columns of two-to-four rows. Nine becomes 3x3. Within each row, every image is scaled height-first to the row's tallest member, which keeps each one's own aspect ratio - the source computes the target width from the original width/height, so nobody gets squashed. Then all the rows are scaled to the widest row's width, and the rows are concatenated vertically with no padding. Net effect: one rectangular image, seamless, everything in proportion.

Channel handling is thoughtful: if any connected image has an alpha channel, all of them are promoted to RGBA with opaque alpha added where needed, and singletons are expanded too. Mixing a transparent PNG with a JPEG won't blow up the concat.

Inputs and outputs

Every input is optional and every one is an IMAGE socket; the only output is image, a single frame. There is nothing to configure - no gap width, no background colour, no column override. That's the trade: it's zero-decision, so it also won't do "3 across with white borders" if that's what you wanted.

Two wiring notes that matter more than the layout math:

  • Only the first frame of each connected batch is used. Feed a 9-tile batch from ImageGridSplit into one port and you'll get a collage of one tile - the first. If you want all nine in the sheet, they need to arrive as separate images (split the batch, or pick tiles individually).
  • At least one connection is required, or it raises At least one IMAGE input is required.

The natural companion in this pack is MengBaoImageConstraint, and the README points at the pairing directly: collage the set, then constrain width/height and the single-PNG file size, because a 3x3 sheet of 4K images is exactly the file that a marketplace uploader rejects.

Installing it

Part of ComfyUI-MengBaoAI - 17 nodes, Corkery520, MIT, Registry id mengbaoai. Manager: search MengBaoAI / mengbaoai / 萌宝AI. CLI: comfy node install mengbaoai. Git route while the Registry release is still clearing:

cd ComfyUI/custom_nodes
git clone https://github.com/Corkery520/ComfyUI-MengBaoAI.git
cd ComfyUI-MengBaoAI
python -m pip install -r requirements.txt

numpy, Pillow, requests - Pillow and torch are what this node really uses, and both come with ComfyUI, so install is quick and needs no model downloads. Restart afterwards; the extra ports are added by the pack's front-end JavaScript, so hit Ctrl+F5 as well, or the node may show only its original four sockets. Search 智能拼图, 拼图, or Smart Collage in the canvas.

Disable the standalone WANG_image_split_crop_nodes plugin if you still have it - duplicate node IDs are the documented reason.

Things that bite

  • Interpolation on every resize. Both scaling passes are bilinear, so an image that gets enlarged to match a taller neighbour will soften slightly. Collage downsized output is fine; collage upscaled output isn't a substitute for an upscaler.
  • Rows can be a bit lumpy. With three images you get two columns - one row of two, one row of one - and the lone image gets stretched width-wise to the row width while keeping its own aspect ratio, which means it's resized, not cropped. Different-shaped inputs produce visibly different scales across a sheet. Square-ish sources look best.
  • Big sheets get expensive to encode. Nine 4K frames concatenated is a very large tensor and a slow PNG write. Constrain before saving, not after.
  • One frame in, one frame out. If you were hoping for a contact sheet from a batch, that's a batch-splitting node's job first.
Category萌宝AI/图像处理

Inputs (20)

NameTypeDefaultDescription
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
image_5optIMAGE
image_6optIMAGE
image_7optIMAGE
image_8optIMAGE
image_9optIMAGE
image_10optIMAGE
image_11optIMAGE
image_12optIMAGE
image_13optIMAGE
image_14optIMAGE
image_15optIMAGE
image_16optIMAGE
image_17optIMAGE
image_18optIMAGE
image_19optIMAGE
image_20optIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE