Nodes/ComfyUI-aihub-workflow-exposer/AIHub Action New Image Batch
ComfyUI Node

AIHub Action New Image Batch

Sending a whole stack of generated images back, numbered, with masks

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Action New Image Batch
  • images
  • masks
  • IMAGE
actionAPPEND
namenew image batch
file_name

AIHub Action New Image Batch is what you reach for when one image isn't enough. Instead of exporting a single frame like AIHub Action New Image, it takes an IMAGE batch tensor - a stack of frames, a grid of variations, a LoRA training set, whatever - and ships the whole thing to the connected client as a numbered batch of PNG files, masks included if you provide them. If the client is building a video or a training dataset, this is the node that gets your images out of ComfyUI and into the right folder structure.

Pack context, same as always: otavanopisto's ComfyUI-aihub-workflow-exposer is a bridge that lets an external app drive ComfyUI. This is an outbound action node - the data goes over the pack's own websocket (port 8111) to whatever client is listening.

How it works

It sends a PREPARE_BATCH message first, telling the client the base filename and whether this batch extends or replaces an existing one. Then it loops through every image in the tensor, encodes each as a PNG (applying the matching mask as an alpha channel), and streams them one by one under NEW_IMAGE events with a batch_index and batch_size in the envelope so the client knows how far along the transfer is. The README's framing is accurate: it's the "call Action New Image many times in APPEND mode" node - a loop that's been wrapped so you don't have to write it.

The inputs that matter

  • images (required) - the IMAGE batch. Frames go out in tensor order, so make sure the ordering matches what the client expects (e.g. frame index for a video pipeline).
  • masks (optional) - a MASK batch aligned with the images. Frame i gets frame i's mask as alpha. Count mismatches are on you - the code indexes into the mask batch positionally.
  • action - APPEND extends an existing batch with the same name; REPLACE wipes it and starts fresh. For training-set generation where you're accumulating images across runs, append is the whole point.
  • name / file_name - the base name for the numbered files (a per-frame number gets added automatically).

It echoes the IMAGE batch back as an output, which is just a convenience so you can keep the data flowing through your graph.

Installing it

ComfyUI Manager (search "ComfyUI-aihub-workflow-exposer"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
# restart ComfyUI

No requirements, no model downloads - it rides on ComfyUI's existing Pillow/torch install.

Where people get burned

Two classic traps. First: mask misalignment. The masks are consumed positionally, so if your mask batch isn't in the exact same order and count as your image batch, you'll silently get transparency in the wrong places. Second - and this is the pack-wide one - if no aihub client is connected, the batch goes nowhere and the node looks like it did nothing. Check the client connection before you suspect the node; in the stock UI this family of nodes produces no visible output by design.

Categoryaihub/actions

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
actionCOMBOAPPENDIf append is selected, the image batch will extend the previous potentially existing images, if replace is selected, the image batch will replace all existing images
nameSTRINGnew image batchThe name of the images to be used as filenames, a number will be added to each image to make it unique
masksoptMASK
file_nameoptSTRINGThe filename to use as base extension included, if not given the name value will be used with a .png extension

Outputs (1)

NameTypeDescription
IMAGEIMAGE