ComfyUI Node

BK Image List

The glue node that feeds the layout nodes

By JayLyu·Created 2 years ago·Updated about a year ago· 8
BK Image List
  • image_list
  • image_1
  • mask_1
  • image_2
  • mask_2
  • image_3
  • mask_3
  • image_4
  • mask_4
  • image_list

Here's a thing that trips people up the first time they touch this pack: BK Image Random Layout and BK Image Rect Layout don't eat plain IMAGE batches - they want an IMAGE_LIST. This node is how you make one. It's the boring utility that everything else depends on, and boring is the compliment.

BK Image List is from the ComfyUI_BaiKong_Node pack, the no-model designer toolkit for color and layout. It takes up to four images (each with an optional mask), bundles them into a list, and can even extend a list you've already built - so you can assemble a list across multiple nodes in a graph rather than cramming everything into one place.

How it works

The inputs are four image/mask pairs, image_1/mask_1 through image_4/mask_4, plus an optional existing image_list. On each run the node collects the incoming list (if any), then processes each pair: an image with a matching mask becomes a 4-channel RGBA image where the mask becomes the alpha channel (with the mask inverted - bright mask = transparent), and an image without a mask stays as-is. Everything lands in one ordered list.

That mask-to-alpha behavior is the useful bit. It means you can pass in a subject cutout plus its mask from an inpainting or segmentation step, and the resulting list item carries its own transparency into the layout nodes - which then composite it without you having to do an alpha-merge first. If the mask shape doesn't match the image shape, the code silently ignores the mask and keeps the image opaque, so a mismatched mask won't crash anything.

Inputs and output

  • image_list (optional) - an existing IMAGE_LIST to extend.
  • image_1 … image_4 / mask_1 … mask_4 (all optional) - up to four pairs. A pair with no image is skipped.

Output is a single image_list (IMAGE_LIST), which you wire straight into the pack's two layout nodes. If you feed nothing in, you get an empty list back - legal, but useless, so keep at least one image connected.

Install

Shared with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/JayLyu/ComfyUI_BaiKong_Node
cd ComfyUI_BaiKong_Node
pip install -r requirements.txt

Restart ComfyUI, or search "ComfyUI_BaiKong_Node" in ComfyUI Manager. Dependencies (scikit-learn, scipy, opencv-python, scikit-image, matplotlib) are CPU-only; no models to download.

Gotchas

The count of four image slots is a hard limit - there's no way to add a fifth pair in one node, which is exactly why the image_list input exists: chain two of these nodes together to grow past four. Also keep in mind this pack's list type is its own IMAGE_LIST, so a list built by a different pack usually won't plug in cleanly. When in doubt, build your lists with this node and feed them to the layout nodes from the same pack.

Category⭐️ Baikong/Image

Inputs (9)

NameTypeDefaultDescription
image_listoptIMAGE_LIST
image_1optIMAGE
mask_1optMASK
image_2optIMAGE
mask_2optMASK
image_3optIMAGE
mask_3optMASK
image_4optIMAGE
mask_4optMASK

Outputs (1)

NameTypeDescription
image_listIMAGE_LIST