Nodes/ComfyUI-YogurtNodes/Batch Images (Yogurt Nodes)
ComfyUI Node

Batch Images (Yogurt Nodes)

Up to 32 images, one batch — without the resolution headache

By yogurt7771·Created 2 years ago·Updated 4 days ago· 1
Batch Images (Yogurt Nodes)
  • images1
  • images2
  • images3
  • images4
  • images5
  • images6
  • images7
  • images8
  • images9
  • images10
  • images11
  • images12
  • images13
  • images14
  • images15
  • images16
  • images17
  • images18
  • images19
  • images20
  • images21
  • images22
  • images23
  • images24
  • images25
  • images26
  • images27
  • images28
  • images29
  • images30
  • images31
  • images32
  • images
  • count
  • width
  • height
  • channels
interpolationlanczos
methodpad
pad_value1.00
start_index0
end_index0
step1

ComfyUI gets its speed from batching - one IMAGE tensor carrying N frames through a sampler is dramatically cheaper than running the same sampler N times. But building that batch is usually the awkward part, because the moment your images have different resolutions, the batch is illegal. Batch Images solves the boring half: it takes up to 32 image inputs, makes them uniform, and combines them into a single tensor. Then it hands you the count, width, height, and channels as plain numbers, which is a sneaky-useful bonus.

How it works

Every image input (images1 through images32) gets resized so the whole batch shares one resolution, then stacked into a single (N, C, H, W) tensor. How the resize happens is up to you:

  • method - stretch (just distort to the target size), fill / crop (scale to cover, then crop the overflow), or pad (scale to fit, pad the leftover with pad_value, default 1 = white). pad is the one that won't wreck your images, which is why it's the default.
  • interpolation - nearest, bilinear, bicubic, area, nearest-exact, lanczos. lanczos is the default and the right choice for most upscaling-flavored batching; nearest only when you want pixel-crisp no-smoothing behavior.

Then the whole batch gets sliced with start_index, end_index, and step - literally Python slice semantics ([start:end:step]). end_index of 0 means "to the end," and negative values work like Python's. So you can not only combine 32 images, you can feed in a big batch and pull out a subset, or every-other-frame it with step 2. That makes the node useful even with a single input: it's a batch slicer that also reports its own dimensions.

Inputs that matter

  • images1 … images32 - the images to combine. All optional; the node works with one, and the max is thirty-two.
  • method / pad_value - how to reconcile resolution differences. Leave on pad unless you have a reason not to.
  • start_index / end_index / step - the slice. Leave at 0 / 0 / 1 for "everything," or slice a subset out of a batch you already have.

Outputs

  • images - the combined (or sliced) batch. Wire it into a sampler, a vision node, or a save node.
  • count - number of images in the output.
  • width, height, channels - the dimensions. These are handy for logic: gate a workflow on image count, or feed the resolution into a resize node. The fact that the node reports them is genuinely useful in automation, not just trivia.

Install

Standard Yogurt Nodes install. ComfyUI Manager → search "ComfyUI-YogurtNodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes && pip install -r requirements.txt

Then restart ComfyUI. Pure tensor work - no models, no downloads.

Where people get burned

Two things. First: pad pads with a solid color, and pad_value 1 is white - if your images have wildly different aspect ratios, padding leaves big white bars that downstream nodes see as content. For photo work you often want fill / crop instead, and for grids of same-size images the whole question disappears. Second, remember that slicing with step reorders nothing and drops nothing silently - it follows Python slicing exactly, so start_index 1 means you lose the first image. If your output count mysteriously looks wrong, walk the slice settings before suspecting a bug. And the one genuinely sharp edge: a batch is only as uniform as you make it, so if you combine images of very different resolutions, the resize step is doing real work - keep an eye on what method you chose or your "no distortion" batch suddenly has squished faces.

CategoryYogurtNodes/Image

Inputs (38)

NameTypeDefaultDescription
interpolationCOMBOlanczos6 options: nearest, bilinear, bicubic, area, nearest-exact, lanczos
methodCOMBOpad3 options: stretch, fill / crop, pad
pad_valueFLOAT1.00
start_indexINT0The start index. Same as Python slicing.
end_indexINT0The end index. Same as Python slicing. 0 means the end. Negative values are also supported.
stepINT1The step. Same as Python slicing.
images1optIMAGEThe image 1 to batch.
images2optIMAGEThe image 2 to batch.
images3optIMAGEThe image 3 to batch.
images4optIMAGEThe image 4 to batch.
images5optIMAGEThe image 5 to batch.
images6optIMAGEThe image 6 to batch.
images7optIMAGEThe image 7 to batch.
images8optIMAGEThe image 8 to batch.
images9optIMAGEThe image 9 to batch.
images10optIMAGEThe image 10 to batch.
images11optIMAGEThe image 11 to batch.
images12optIMAGEThe image 12 to batch.
images13optIMAGEThe image 13 to batch.
images14optIMAGEThe image 14 to batch.
images15optIMAGEThe image 15 to batch.
images16optIMAGEThe image 16 to batch.
images17optIMAGEThe image 17 to batch.
images18optIMAGEThe image 18 to batch.
images19optIMAGEThe image 19 to batch.
images20optIMAGEThe image 20 to batch.
images21optIMAGEThe image 21 to batch.
images22optIMAGEThe image 22 to batch.
images23optIMAGEThe image 23 to batch.
images24optIMAGEThe image 24 to batch.
images25optIMAGEThe image 25 to batch.
images26optIMAGEThe image 26 to batch.
images27optIMAGEThe image 27 to batch.
images28optIMAGEThe image 28 to batch.
images29optIMAGEThe image 29 to batch.
images30optIMAGEThe image 30 to batch.
images31optIMAGEThe image 31 to batch.
images32optIMAGEThe image 32 to batch.

Outputs (5)

NameTypeDescription
imagesIMAGE
countINT
widthINT
heightINT
channelsINT