Image Batch Compose (PixNodes)
Many image inputs, one normalized batch
- image_1
- image_batch
The classic ComfyUI problem: you've got images coming from different places - one from a Load Image, one from an upscaler, one from a VAE decode - and you need them as one stack before you can batch-process them. Pix_ImageBatchCompose is the node that collects them. Its trick is dynamic inputs: it starts with image_1, and the moment you connect it, image_2 appears, then image_3, on and on. You wire up as many as you have and get one [B, H, W, C] batch out.
The controls are mode (Fit, Fill, Stretch), alignment (nine positions from Top Left to Bottom Right), background_color (default #FFFFFF), and size. That last one is the sleeper feature: give it 1920x1080 or just 512 (square) and every image is normalized to that size. Leave it empty and it defaults to the size of the first connected image, aligning everything else to it - which is the behavior you want when you don't care about the target size, you just need uniform dimensions.
Mode and alignment interact, and the docs' framing is the right one to hold: in Fit, alignment decides where the image sits in the padded canvas (Center is the default and usually what you want); in Fill, alignment decides where the crop happens - Top keeps the top of the image and cuts the bottom, which is genuinely useful when your source is a tall character shot and you're filling a wide box. Stretch ignores alignment entirely and just distorts.
The color parser is quietly the most defensive code in the pack. background_color accepts #RRGGBB, FF0000 without a hash, rgb(255, 0, 0), 255,0,0, the packed decimal 16711680, [255, 0, 0] arrays, even an 8-digit hex where the alpha gets discarded - and there's a documented priority order for which interpretation wins. That's over-engineering for most users, but it means pasting a color in from any other tool just works, which is more than you can say for most STRING color widgets.
Under the hood it's torch.nn.functional.interpolate with bilinear sampling, batched per frame, so the resizing is pure tensor math - fast, and it handles a batch as one op. Inputs with a single channel get repeated to RGB, 4-channel images get trimmed to RGB, and 3D tensors get a batch dimension added, so it forgives a lot of sloppy upstream types.
Install: ComfyUI Manager, search PixNodes, restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes
cd Comfyui-PixNodes
pip install -r requirements.txt
then restart. Just openai and Requests; the heavy lifting is ComfyUI's own torch.
Where it shines in practice: ControlNet or IPAdapter prep, where multiple source images at mismatched resolutions will error out the batch - run them through this first to force uniformity. The one trap is forgetting size exists and wondering why everything snapped to image_1's dimensions; set it explicitly when your target size matters.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Fill | 3 options: Fit, Fill, Stretch |
| alignment | COMBO | Center | 9 options: Top Left, Top, Top Right, Left, Center, Right, +3 |
| background_color | STRING | #FFFFFF | — |
| size | STRING | — | |
| image_1opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image_batch | IMAGE | — |