SplitImageWithAlpha_motorway_edition
Split an RGBA image back into pixels and alpha
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
If you're dealing with PNGs that carry transparency - cutouts from a background-removal node, assets saved out of Photoshop - you'll eventually want to separate the color from the alpha channel. That's exactly what SplitImageWithAlpha does: one RGBA image in, an RGB image and a separate mask out. This is the Motorway edition, so it reads the image from the pipe by key instead of by a direct wire.
Why bother? Because half of ComfyUI's tooling wants a clean image, and the other half wants a mask, and an RGBA image is neither. If you feed an image with an alpha channel straight into a compositing or upscale step, the alpha can silently leak into the result or the model reads the alpha channel as data it shouldn't. Split it first, keep the RGB for the image path and the alpha as the mask for the compositing path, and everything behaves.
What to set
Three key fields, no widgets:
INPUT_image_key(defaultimage) - the Motorway key holding the RGBA IMAGE.OUTPUT_IMAGE_key(defaultIMAGE) - where the RGB image (alpha stripped) gets written.OUTPUT_MASK_key(defaultMASK) - where the alpha channel, as a mask, gets written.
Output is the MOTORWAY with both IMAGE and MASK inside it. That's the nice part of the Motorway pattern here: one run produces two things and they both just land in the pipe under different keys. Later you read IMAGE into your sampler path and MASK into a compositing or inpainting step.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart; it's under agilly1989 Nodes → Motorway-ed → mask → compositing. Manager can install the pack too. No pip deps - the motorway-ed nodes are pure-Python wrappers around ComfyUI's own nodes.
Where people get burned
The input has to actually have an alpha channel, or the "split" is just an image pass-through and your mask comes out blank. If your MASK comes back empty, check that the image in the pipe isn't an RGB that lost its alpha somewhere upstream.
And the standard Motorway trap: keys must match exactly, and they're case-sensitive. 'MotorwayClass' object has no attribute 'hash_' means the key you typed in INPUT_image_key isn't in the Motorway - verify what the node writing image actually named it. Finally, the pack itself is in active beta (the README's words), and the auto-cloned motorway-ed nodes have been toggled on and off across releases. An update making the node disappear is a pack change, not something you broke.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_image_key | STRING | image | — |
| OUTPUT_IMAGE_key | STRING | IMAGE | — |
| OUTPUT_MASK_key | STRING | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |