Nodes/Comfyui-PixNodes/Create Image Batch (PixNodes)
ComfyUI Node

Create Image Batch (PixNodes)

Upload images, get a clean batch out

By pixixai·Created 8 months ago·Updated 6 months ago· 24
Create Image Batch (PixNodes)
    • image_batch
    • image_list
    batch_width1080
    batch_height1080
    method
    bg_color#000000

    The workflow is: you have a folder of reference images, and you need them as one standardized batch for a sampler, an IPAdapter, or a ControlNet pipeline. ComfyUI's built-in Load Image loads one image. This node loads many, right in the node's own UI, with drag-to-reorder, multi-select, undo - and it hands you both a normalized batch and the original-sized list.

    The parameters you actually touch: batch_width and batch_height (64–4096, step 8, default 1080 each) set the output size of the main batch; method picks how each image is forced into that box; bg_color is the fill color for fit mode. The three methods are the standard trio, and the trade-offs are worth internalizing:

    • fill - scale up until the image covers the box, then center-crop. No empty space, but edges get cut.
    • fit - scale down until the image fits inside the box, then pad with bg_color. Nothing cut, but you get letterbox bars.
    • stretch - scale non-uniformly to exactly fill the box. Fits perfectly and will distort aspect ratios.

    Which to pick depends on downstream: for image-to-image work, fill matches what the sampler expects (no bars to leak into conditioning); for anything where the subject can't afford a crop, fit with a matching bg color is safer. stretch is the lazy option - you get no bars and no crop, but stretched faces are the kind of artifact that's subtle in preview and obvious in the result.

    Two outputs, and this is where the node earns its keep. image_batch is the stacked [B, H, W, C] tensor, all frames resized to your batch_width/batch_height - that's the one that plugs into a KSampler or VAE Encode. image_list is a list of the original images, untouched, for any node that wants source resolution. Getting both from one upload is the reason to use this instead of a folder loader plus a resize chain. The frontend keeps the list state in a hidden image_data field, and the 1.0.8 changelog added auto-detection and cleanup of black/empty images so a corrupt frame doesn't silently poison the whole batch.

    There's a real interaction quirk to know: the upload UI is a custom JS widget, so the image list travels inside the workflow JSON as data, not as files on disk. Reorder in the node, run, and the batch order follows your visual order - which is exactly the point of the drag-to-reorder feature, and also why it's easy to forget that a deleted file in your input folder means the node logs a "file not found" warning and skips it.

    Install is the standard PixNodes path - 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. Requirements are just openai and Requests - the image handling is all PIL and torch, already in ComfyUI. No model downloads.

    Honest take: for one-shot image uploads, the core Load Image is fine and this is overkill. Where it wins is iteration - a batch of references you reorder and re-run a dozen times, where the in-node preview and undo save you from a folder-loading detour every time.

    CategoryPixNodes

    Inputs (4)

    NameTypeDefaultDescription
    batch_widthINT108064–4096
    batch_heightINT108064–4096
    methodCOMBO3 options: fill, fit, stretch
    bg_colorSTRING#000000

    Outputs (2)

    NameTypeDescription
    image_batchIMAGE
    image_listIMAGE