Image List to Batch (PixNodes)
Make a pile of differently-sized images play nice in one batch
- image_list
- image_batch
ComfyUI is picky about batches: a torch.cat on the batch dimension only works when every image is the same height and width, so the moment you load a folder of mixed-size images and try to run them through a VAE encode as one batch, it errors out. Image List to Batch exists to absorb that. It takes a list of images that may all be different sizes and normalizes them into a single uniform image_batch tensor, with real control over how the resizing happens.
This is the node you reach for when a "load every PNG in this folder" workflow feeds you mismatched dimensions and the sampler or encoder downstream starts screaming about shape mismatches.
How the normalization works
The node runs with INPUT_IS_LIST, meaning it expects a list of image tensors (usually from a folder/iterator node), not one tensor. Each image is resized to a target size - by default the size of the first image in the list, or a size you type into the size field. The mode dropdown decides the resize strategy:
- Stretch - squashes every image to the exact target size. Fast, but you're warping aspect ratios, which is wrong for faces and text.
- Fit - scales to fit inside the target while keeping aspect ratio, then pads the leftover space with
background_color. No distortion, but you get bars. - Fill - scales to cover the target and crops the overflow. No bars, no distortion, but edges get cut.
alignment (9 options, Center by default) controls where the image sits in the canvas for Fit, or which part survives for Fill. And background_color is the string that defaults to #FFFFFF; the parser is remarkably tolerant - it handles #FFFFFF, #FF0000 style hex, rgb(255, 0, 0), plain 255,0,0, decimal integers like 16777215, and even float tuples interpreted as HSV.
The inputs that actually matter
image_list(IMAGE, forced input) - the list to normalize. Note it'sforceInput, so it must be wired, not typed.mode- Fit / Fill / Stretch.background_color- the padding color, when Fit leaves bars.size- optional"512x512"; leave empty to use the first image's size.
Single output: image_batch (IMAGE), the concatenated uniform tensor. It also quietly handles edge cases - masks (1-channel) get expanded to RGB, RGBA drops the alpha, and a list of images gets concatenated along the batch dimension.
Install
Part of Comfyui-PixNodes. ComfyUI Manager → search "PixNodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/pixixai/Comfyui-PixNodes
then restart. (The README's manual-install block pastes the wrong repo URL - ComfyUI-AlignLayout - use the one above.) No models, no heavy deps.
The gotchas
Fit mode pads, and if you don't care about the bars you should set background_color explicitly - a default white pad behind a transparent-heavy workflow reads wrong downstream. And because Stretch and Fill both throw away or smear pixels, this is a normalization node, not a quality tool: keep it for prep work like batching VAE encodes or feeding a batch upscaler, not for anything where aspect ratio fidelity is the product.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image_list | IMAGE | — | |
| 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 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image_batch | IMAGE | — |