invert channel adv
Split, invert, and reassemble image channels
- RGBA_or_RGB
- RGBA_Bath
- RGB_Bath
- R
- G
- B
- A
- RGBA
- RGB
- R
- G
- B
- A
- RGB_Bath
- RGBA_Bath
Sometimes you need to get genuinely surgical with an image's color channels: pull the alpha channel out as its own mask, invert just the red channel without touching the rest, or weld four separate mask batches into one RGBA image. invert_channel_adv is built for exactly that kind of channel-level work - split apart, invert, replace, and put back together, with batch support throughout.
It's one of the image-editing nodes in ComfyUI-WJNodes, a large personal utility pack from GitHub user 807502278 covering everything from cropping to video slicing to file operations.
How it works
You can feed it a whole image (RGBA_or_RGB), pre-batched channel data (RGBA_Bath or RGB_Bath - note the pack's own spelling, not a typo you need to fix), or individual R/G/B/A channels as separate masks. If you connect only channels with no base image, the node builds a fresh image out of them. When multiple channel sources are connected at once, there's a defined replacement priority: individual R/G/B/A inputs win over RGB_Bath, which wins over RGBA_Bath, which wins over RGBA_or_RGB - so the most specific thing you connect always takes precedence over the more general one. The four invert_* toggles flip the corresponding channel after all the replacement logic has been applied.
The inputs and outputs that matter
RGBA_or_RGB(optional IMAGE) - a full image whose channels get replaced by anything more specific you've also connected.RGBA_Bath/RGB_Bath(optional MASK) - batched channel data, for recombining separately-processed channels back into one image.R/G/B/A(optional MASK each) - individual channels, the most specific and highest-priority inputs. All connected channels need matching resolution.invert_R/invert_G/invert_B/invert_A(all default off) - flip the corresponding channel.device(defaultOriginal) - where the computation runs;Autoorcpuare the alternatives.
Outputs cover both directions: RGBA and RGB as full images, R/G/B/A as individual mask channels, and RGB_Bath/RGBA_Bath as batched channel masks - useful for feeding into this pack's own mask-math nodes, which only operate on masks, not full images.
How to install it
Via ComfyUI Manager, search "ComfyUI-WJNodes." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
Restart ComfyUI. No model downloads needed - this is channel-level tensor manipulation, nothing inference-based.
Common issues & troubleshooting
A channel you connected didn't seem to apply. Check the replacement priority - individual R/G/B/A beats RGB_Bath, which beats RGBA_Bath, which beats RGBA_or_RGB. If you've connected more than one channel source at once, the more general one is likely being overridden by a more specific one you forgot was also wired in.
Output looks black in one channel. The node fills any channel with no data behind it as black - this is expected if you built an image purely from a partial set of channels and left one unconnected.
Batch-matching auto-detection isn't working. The author's own description is blunt about this: attempting to auto-match mismatched batch sizes across inputs "often fails." Keep your batch sizes consistent across every connected input rather than relying on this fallback.
_Bath outputs confusing you. That's the pack's actual spelling for "Batch" in these specific slot names - not a display bug on your end, just how the node ships.
No community reference for edge cases. This is a niche utility in a personal pack with no public discussion around it - the safest path when something looks off is isolating one input at a time and checking each output individually rather than debugging a fully-wired graph at once.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| invert_R | BOOLEAN | false | — |
| invert_G | BOOLEAN | false | — |
| invert_B | BOOLEAN | false | — |
| invert_A | BOOLEAN | false | — |
| device | COMBO | Original | 3 options: Original, Auto, cpu |
| RGBA_or_RGBopt | IMAGE | — | |
| RGBA_Bathopt | MASK | — | |
| RGB_Bathopt | MASK | — | |
| Ropt | MASK | — | |
| Gopt | MASK | — | |
| Bopt | MASK | — | |
| Aopt | MASK | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| RGBA | IMAGE | — |
| RGB | IMAGE | — |
| R | MASK | — |
| G | MASK | — |
| B | MASK | — |
| A | MASK | — |
| RGB_Bath | MASK | — |
| RGBA_Bath | MASK | — |