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

AIHub Action New Image

Sending a generated image back to the app that called your workflow

By otavanopisto·Created about a year ago·Updated 22 days ago· 7
AIHub Action New Image
  • image
  • mask
  • IMAGE
  • MASK
actionAPPEND
namenew image
file_name
autoopenfalse

AIHub Action New Image is the most basic and most useful "give the result back" node in this pack. You've run your sampling, your VAE decode, maybe a fix pass - and now you want the image to land in the external application that launched the workflow, not just inside ComfyUI's own output folder. This node takes the IMAGE tensor, encodes it as PNG, and hands it to the connected client under a NEW_IMAGE event. Optionally it ships a mask along as an alpha channel, which is how generated results come back as transparent layers instead of flat rectangles.

Context, because it matters: otavanopisto's ComfyUI-aihub-workflow-exposer turns ComfyUI into a generation engine for another app. Expose nodes bring data in from the client; action nodes push results back over the pack's own websocket (port 8111 by default). This node is the archetype of the whole "actions" family - understand it and every other action node is a variation.

How it works

When run, it takes the first image off the IMAGE batch, converts the tensor to bytes with PIL, and - if you passed a mask - composites it into the PNG's alpha channel before sending. The websocket message includes the filename, the friendly name, and your APPEND/REPLACE choice so the client knows whether to keep every take or overwrite the last one. It's an output node with IS_CHANGED forced to always dirty, so it fires on every run no matter what.

The inputs that matter

  • image (required) - what you're exporting. Wire the VAE decode output here.
  • mask (optional) - an alpha channel. Handy for inpainting or cutout workflows where the client should receive a transparency-masked PNG, not a baked-in background. Only the first mask frame is used.
  • action - APPEND or REPLACE. Append adds a number to the filename when a file with that name exists; replace overwrites. For a "generate a new variant every run" workflow, append.
  • name - the internal name and the basis for the filename unless overridden.
  • file_name - optional explicit filename (.png is appended if you omit it).
  • autoopen - if true, the client pops the image in a new tab when it arrives. A tiny preview nicety.

It outputs the IMAGE and MASK back, so it's chainable, but the real point is the side effect.

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

Nothing to download - the pack has no requirements file and reuses ComfyUI's own Pillow/torch stack.

Where people get burned

Same story as every node in this pack: run it in the stock web UI and nothing visibly happens, because the image goes out over the aihub websocket to a client that isn't connected. If you expected a preview window, you'll think it's broken - it isn't; there's nobody on the other end. Second gotcha: if image is None the node quietly returns (None, None) instead of erroring, so a silently skipped export usually means the upstream generation produced nothing, not that this node failed.

Categoryaihub/actions

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
actionCOMBOAPPENDIf append is selected, if the image exist it will be added a number to the name to make it unique, if replace is selected, the image will be replaced with the new one
nameSTRINGnew imageThe name of the image this is used internally
maskoptMASK
file_nameoptSTRINGThe filename to use, if not given the name value will be used with a .png extension
autoopenoptBOOLEANfalseIf set to true, the image will be automatically opened in a new tab when added

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK