Nodes/ꘇ Genereti/ꘇ top.channels
ComfyUI Node

ꘇ top.channels

Build any mask from any image, in one node

By languel·Created about a month ago·Updated 3 days ago· 1
ꘇ top.channels
  • image
  • image_b
  • image
◄redr►
◄greeng►
◄blueb►
◄alphaa►
◄channelsRGBA►

Most of the mask work in a ComfyUI graph is really channel work in disguise. You want the luminance of one image as an alpha for another; you want the alpha of a cutout turned into a visible black-and-white mask so you can see it; you want an image's red channel and a second image's green channel in the same RGB. top.channels is the node that does all of that without arithmetic tricks.

It's one of the 28 TOP operators in ꘇ Genereti (languel/genereti, by Liuboto, MIT, super-alpha), the realtime creative-coding pack for ComfyUI. It's a plumbing node in the best sense - the kind the KB's plumbing essay argues is 70% of any real workflow and almost never written about.

What it does

You get four routing dropdowns - red, green, blue, alpha - and each one picks a source channel to place in that output slot. The full menu is:

r, g, b, a, luma, zero, one, br, bg, bb, ba, bluma

The b-prefixed entries read from the optional second image, image_b. luma (and bluma) is the Rec.709 weighted luminance of RGB. zero and one are exactly the constants they sound like - and they're the reason this node is genuinely useful rather than a curiosity, because zero on RGB plus one on alpha is a white mask, and the reverse is a black one.

The fifth combo, channels, chooses RGB or RGBA, and it changes the alpha behaviour in a way you should know about before it surprises you. In RGBA, your alpha routing is honoured. In RGB, live GPU storage forces alpha opaque - and the queued path returns three channels rather than four. The author documents this difference explicitly, which is more than most packs would.

If image_b isn't connected, B defaults to A - so the b-prefixed options quietly read the same image. And if B is a different size, it's resized to A before routing.

The four jobs you'll actually use it for

Luminance → mask. Route luma into red, green and blue, set channels to RGB: now a colour image is a grayscale mask you can see, feed to top.mask, or composite with. Swap in a and you've turned a cutout's alpha into a visible matte - the standard way to sanity-check a background removal before you trust it.

Channel packing. r from A into red, bg into green, ba into blue gives you a packed texture from two sources. That's the classic displacement-map setup: one image's channels driving top.displace along X and Y.

Swaps and reorders. Nobody ever plans to need b into red and r into blue. You will anyway.

Constants. Combined with top.composite or top.math, zero and one give you clean endpoints without a second image.

Live versus Queue

Live, this is a WebGPU channel shuffle - basically free. On Queue it's a PyTorch operation on the tensor, and the pack's utility validation (all 12 utility TOPs, 2026-10-10) recorded at most a one-byte difference between GPU and torch outputs on the synthetic comparison cases. Batches follow the family rule: one B broadcasts, otherwise they must match in size.

Install

Manager → search "Genereti" → install ꘇ Genereti → restart ComfyUI → refresh the browser page. Manual:

git clone https://github.com/languel/genereti.git custom_nodes/genereti
./.venv/bin/python -m pip install -r custom_nodes/genereti/requirements.txt

Only comfyui-frontend-package>=1.53.6 is pinned. ComfyUI 0.38.2+, Python 3.11+, WebGPU browser for live. The pack's TOP examples live under Workflows → Genereti; ꘇ-Class-Feedback-Bloom-Displace shows channel routing in a working feedback chain.

Gotchas

RGB mode eats your alpha. The pack is explicit about it - RGB forces opaque alpha in live GPU storage and returns three channels in Queue. If you're building a matte and it mysteriously comes back opaque, this is why. Use RGBA.

b-prefixed routing with no B connected reads A. Helpful until you're debugging a graph where you thought a second image was wired. If your packed output looks like a straight copy, check the wire, not the node.

Straight alpha in, straight alpha out. Compositing neighbours in this family use premultiplied math internally to avoid fringes, so routing alpha around is safe - but if you're hand-building a cutout from an unpremultiplied image, garbage RGB under zero alpha will still be garbage if you later choose to ignore alpha.

CategoryGenereti / TOP

Inputs (7)

NameTypeDefaultDescription
imageIMAGE—
redCOMBOr12 options: r, g, b, a, luma, zero, +6
greenCOMBOg12 options: r, g, b, a, luma, zero, +6
blueCOMBOb12 options: r, g, b, a, luma, zero, +6
alphaCOMBOa12 options: r, g, b, a, luma, zero, +6
channelsCOMBORGBA2 options: RGB, RGBA
image_boptIMAGE—

Outputs (1)

NameTypeDescription
imageIMAGE—