Nodes/ComfyUI_Gemini/🧺 Gemini List β†’ Batch (Padded)
ComfyUI Node

🧺 Gemini List β†’ Batch (Padded)

Stack mixed-size images into a real batch without distorting them

By aarnoatchiΒ·Created 2 months agoΒ·Updated 2 months agoΒ· 0
🧺 Gemini List β†’ Batch (Padded)
  • images
  • batch
  • width
  • height
  • count
β—„pad_color0.00β–Ί
β—„aligncenterβ–Ί

Gemini List β†’ Batch (Padded) takes a list of images with different sizes and stacks them into a real ComfyUI IMAGE batch - without scaling any of them. Each image is pasted onto a canvas sized to the largest H and W in the list, so pixels stay at native scale and smaller images just get a border. Local, no API, no key.

This is the node that stops a very specific, very common ComfyUI error from ever reaching you. A batch is one tensor, so every image in it must share H and W; the moment you feed mixed-size images into a batch consumer, you get a shape error or a silent resize to whatever the first image happened to be. The pack's README is direct about this: comfyui_essentials' "Image List to Batch" resizes everything to the first image's size because that's the only way to make a valid tensor - but resize is distortion, and distortion is what you're usually trying to avoid.

How it works

The node computes the maximum width and height across the whole list, then for each image creates a canvas of that size and pastes the image onto it. pad_color (default 0, range 0–1) is the border fill - 0.0 is black, 1.0 is white - and align is center (default) or top-left, which decides where each image sits on its canvas. That's the whole interface: two knobs, both intuitive.

Outputs: batch (the valid IMAGE batch), plus width, height (the canvas size it settled on), and count (how many images went in). The width/height outputs are the nice touch - wire them anywhere a downstream node needs to know the actual canvas, and you don't have to recompute it.

The trade, stated honestly

Padding is the honest alternative to distortion, but it isn't free. You get a batch every image in shares dimensions, which is what batch consumers demand - but you've also introduced borders, and borders can leak into the result: a diffusion model happily renders a black bar into your padded area. So the real decision is: does the downstream stage accept a list (then use List Passthrough / Select Image From List and skip batching entirely), or does it genuinely need a batch (then this is the right tool, and you accept the padding)? The node is the right answer to the second question; it's just worth being sure you're asking the second question.

When to reach for it

Batch-processing stages - an upscaler that runs per-batch, a grid builder, a model that wants a uniform input tensor, a loop that iterates a batch with an index (paired with Image Select). If your images already match in size, this node is a no-op on the content; if they're wildly different, consider whether a list is acceptable before padding, because the border situation only gets worse with more aspect variety.

Install

Standard pack install: ComfyUI Manager search "ComfyUI_Gemini", or git clone https://github.com/aarnoatchi/ComfyUI_Gemini into custom_nodes and pip install -r requirements.txt. No scipy, no key, nothing beyond the shared dependencies. Under AI/Image Analysis/Google after restart. And if you're wondering why a "Gemini" node does this: it doesn't touch Gemini - the pack just parks all its utilities under that name.

CategoryAI/Image Analysis/Google

Inputs (3)

NameTypeDefaultDescription
imagesIMAGEAn image LIST (mixed dimensions allowed).
pad_coloroptFLOAT0.000–1Border fill value. 0.0 = black, 1.0 = white.
alignoptCOMBOcenterWhere each image sits on the padded canvas.

Outputs (4)

NameTypeDescription
batchIMAGEβ€”
widthINTβ€”
heightINTβ€”
countINTβ€”