[SSN] Prep Flatten Alpha
The 'stick transparent layers onto a background' node every RGBA workflow needs
- images
- background_color
- IMAGE
[SSN] Prep Flatten Alpha takes an image with an alpha channel and composites it onto a solid background color, giving you a plain 3-channel RGB image out the other side. It's the "stop being transparent" node, and if you work with RGBA at all - cutouts, text overlays, anything that came out of a background-removal model - you will want it.
Here's the situation it exists for. This pack's own SsnDrawText always outputs RGBA, and image matting tools and background-removal pipelines routinely produce transparent PNGs. But a huge amount of downstream ComfyUI machinery - encoders, previews, most compositing - wants opaque RGB. A transparent region isn't "nothing"; it's alpha=0 over whatever the next node assumes is behind it, which is frequently black, and that's how you get a dark halo around your subject or a text overlay that looks burned. Flatten Alpha solves it by doing the actual alpha compositing: rgb * alpha + background * (1 - alpha) per pixel, blending the transparent edges against a color you choose.
The two inputs are exactly what you'd hope: images (the RGBA batch) and background_color, which is a COLOR - so it wires straight into SsnInputColor's picker. Pick black for the classic matte look, white for a clean background, or any color to match the canvas your cutout is destined for. The node asserts your input is 4-channel and will throw "Images must be RGBA" if you feed it a 3-channel image - that's a strictness that saves you from silent nonsense, and it's consistent with the other prep nodes in this pack.
Where it sits in the post-processing layer: after the draw/trim prep, before the output. The canonical smn_support_nodes chain is Draw Text or Trim Scale → Flatten Alpha → Output WebM, which is exactly how you turn a transparent text layer or a trimmed sprite into a video-ready opaque sequence. If your pipeline already handles RGBA downstream, you don't need it - but most pipelines don't.
Install
Part of smn_support_nodes by SummonTheCat. ComfyUI Manager → search smn_support_nodes → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/SummonTheCat/smn_support_nodes
Restart required. Dependencies (opencv-python, imageio-ffmpeg) auto-install; no models to download.
Troubleshooting
The one hard error is feeding it RGB - it explicitly requires RGBA and refuses to guess, so convert to 4 channels first (SsnDrawText already gives you RGBA; for plain RGB images you'll need an "add alpha" node from another pack). Beyond that, watch the background choice: black is the default, and if your flattened result looks like it has a black tinge around edges, you picked the wrong backdrop for that composition. The output is 3-channel, which is exactly what RGB-only downstream nodes want.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| background_color | COLOR | #000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |