Nodes/ComfyUI Layer Style/LayerUtility: ImageHub
ComfyUI Node Runs on cloud

LayerUtility: ImageHub

ImageHub — a 9-way image switch for tidying up busy graphs

By chflame163·Created 3 years ago·Updated 5 days ago· 3,113
LayerUtility: ImageHub
  • input1_image
  • input1_mask
  • input2_image
  • input2_mask
  • input3_image
  • input3_mask
  • input4_image
  • input4_mask
  • input5_image
  • input5_mask
  • input6_image
  • input6_mask
  • input7_image
  • input7_mask
  • input8_image
  • input8_mask
  • input9_image
  • input9_mask
  • image
  • mask
â—„output1â–º
â—„random_outputfalseâ–º

A switch node, and a fairly generous one - up to nine image/mask pairs feed in, and one comes out, picked either by an explicit index or at random. If you've ever built a workflow with several candidate images (different LoRA variants, different seeds, different pipeline branches) and wired a chain of "which one do I actually want to send downstream" logic, this replaces that mess with one node.

How it works

You wire up to nine optional image inputs (each with a matching optional mask), and the node passes through whichever one you selected via output. Set random_output to true and it ignores the index and picks one of the connected inputs at random each run instead - useful for quick A/B comparisons or injecting variety into a batch without manually rewiring which branch feeds forward.

The value here isn't clever processing, it's graph hygiene. A common shape this solves: you've built three or four variant branches (different upscalers, different color grades, different edit-model outputs) that all converge into the rest of the pipeline, and instead of rewiring which branch's noodle plugs into the next node every time you want to compare them, you plug all of them into one ImageHub and just flip a number. It's the same instinct as a physical patch bay - keep everything connected, change which signal is live with one control.

The inputs and outputs that matter

  • output (default 1, range 1–9) - which numbered input to pass through. Corresponds to input1_image/input1_mask through input9_image/input9_mask.
  • random_output (default false) - when true, picks randomly among whichever inputs are actually connected, overriding output.
  • input1_image through input9_image (all optional IMAGE), plus matching input1_mask through input9_mask (optional MASK) - wire in as many or as few of the nine slots as you actually need; you don't have to fill all of them.

Outputs: a single image and mask, whichever pair got selected.

How to install it

Search ComfyUI Layer Style in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
pip install -r ComfyUI_LayerStyle/requirements.txt

Restart; find it under 😺dzNodes → LayerUtility.

Common issues

The obvious one: setting output to a slot number you never actually connected - the node has nothing to pass through and either errors or gives you an empty result, depending on how it's downstream-consumed. Double-check the index matches a slot you genuinely wired something into. The other trap is random_output combined with a workflow that expects deterministic, repeatable results - if you're trying to debug why a graph produces a different final image on reruns with the same seed everywhere else, check whether an ImageHub upstream has random_output flipped on; that's an easy thing to forget you set. Beyond that it's a straightforward router - no processing happens to the image itself, it's purely a "which wire wins" decision.

Category😺dzNodes/LayerUtility

Inputs (20)

NameTypeDefaultDescription
outputINT11–9—
random_outputBOOLEANfalse—
input1_imageoptIMAGE—
input1_maskoptMASK—
input2_imageoptIMAGE—
input2_maskoptMASK—
input3_imageoptIMAGE—
input3_maskoptMASK—
input4_imageoptIMAGE—
input4_maskoptMASK—
input5_imageoptIMAGE—
input5_maskoptMASK—
input6_imageoptIMAGE—
input6_maskoptMASK—
input7_imageoptIMAGE—
input7_maskoptMASK—
input8_imageoptIMAGE—
input8_maskoptMASK—
input9_imageoptIMAGE—
input9_maskoptMASK—

Outputs (2)

NameTypeDescription
imageIMAGE—
maskMASK—