Paste Crops with Masks
The node that stitches your separately-generated panels back into a page
- base_image
- cropped_images
- masks
- bboxes
- IMAGE
Paste Crops with Masks is the payoff node of this whole pack: it's how you assemble a finished comic page from individually-generated panel art. The flow that makes sense of everything else in comfyui-panels is - build your page as polygons, crop each panel out, generate art inside each crop, then paste the results back into the page. This node is the "paste back."
It takes your base page image plus a list of cropped panel images, a list of masks, and a list of bounding boxes, and blends each crop into the base at its corresponding bbox, masked so only the panel's own shape shows through. The blend is a straightforward alpha-style composite: base * (1 - mask) + crop * mask. Anything outside the mask stays untouched, which is how neighboring panels and the page background survive the operation.
The four inputs, all required:
- base_image - the page you're assembling into.
- cropped_images - your generated panel crops.
- masks - one per crop, defining the panel's shape (this is where Polygon To Resized Mask usually comes in).
- bboxes - where each crop lands on the base page.
It's list-in, list-out by design: you're pasting many panels in one shot, and the three lists zip together positionally.
Here's the honest gotcha, straight from the node's own description: if a crop doesn't match its bbox size, it gets resized to fit - bilinear interpolation, which means quality loss. The author's warning is worth quoting because it's the difference between a clean page and soft mush: "To avoid quality loss keep the image-mask-bbox pairs with the same dimensions." In practice: generate your panel at the exact pixel size its bbox implies, and don't let mismatches creep in. The common cause of a mismatch is feeding in a mask from Polygon To Mask (which is sized to the polygon's bounds) but a bbox with different dimensions. That's precisely why Polygon To Resized Mask exists and why the README points you at it for this node - it makes the sizes agree on purpose.
The single output is the assembled IMAGE. From there it's a normal ComfyUI output path: save it, or feed it onward.
Where it fits in a real comic pipeline: build panels → crop each → generate (or inpaint) per panel → paste all back in one call. Because everything is positional (lists in, image out), it also plays well with the crop/slice nodes in this pack when you need to re-order or subset panels before assembly. If you're doing the "character consistency across panels" dance - same character in every panel via a LoRA or IP-adapter - this is the node that finally turns N separate generations into one page again.
Installing
Part of comfyui-panels by bmad4ever. Via ComfyUI Manager (search "comfyui-panels") and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_panels
Deps are shapely, matplotlib, opencv-python - no model downloads, no GPU needed for the node itself (the generation you feed into it is a different story). Shapely is pinned exactly; watch for clashes with other packs.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| base_image | IMAGE | — | |
| cropped_images | IMAGE | — | |
| masks | MASK | — | |
| bboxes | BBOX | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |