RGBA Multi Save (Swwan)
Saving transparent PNGs without the white fringes
- image
- alpha
If you've ever run a transparent PNG through a ComfyUI image node and gotten a white or black halo around the edges, you've hit the problem this whole RGBA family exists to solve. ComfyUI's IMAGE tensor doesn't carry alpha - most nodes are RGB-only - so Load Image converts transparency into an inverted mask, and by the time you've resized, blurred or composited, the alpha is either gone or the edges are fringed.
RGBA Multi Save is the final-output node of that family. It takes a premultiplied image plus its real alpha, and writes a JPEG, PNG or WebP - keeping transparency when you want it, flattening to RGB when you don't. The name undersells it a bit: it quietly includes the "safe unpremultiply" logic internally, so it can replace a whole sub-graph of post-processing.
What it needs
To use it you first pass the image through the pack's RGBA Safe Pre node, which does two things: converts Load Image's inverted mask into a real alpha, and premultiplies the RGB so it survives RGB-only processing without dark edges. It hands you three outputs you feed straight into this node:
image- the processed (still premultiplied) imagealpha- the real alpha from Prehas_alpha- a boolean saying whether the source actually had transparency
Then you pick file_format (jpeg/png/webp), alpha_mode, and a filename_prefix. The optional group is where the tuning lives: epsilon (the lower alpha clamp that prevents divide-by-zero and blown edges during unpremultiply - keep 0.001), background color for flattening (defaults to white, which is why flattened PNGs come out with a white backing), and per-format quality/compression settings.
How alpha_mode behaves
| format | auto | keep | flatten |
|---|---|---|---|
| jpeg | flattened RGB | flattened RGB | flattened RGB |
| png | keeps alpha if has_alpha | keeps alpha if has_alpha | flattened RGB |
| webp | keeps alpha if has_alpha | keeps alpha if has_alpha | flattened RGB |
auto is the right default for almost everything - it's the "do the sensible thing" switch. keep is for when you explicitly want transparent output and want to be sure. flatten forces a normal RGB file (thumbnails, social posts, training-set JPEGs), and because it skips the unpremultiply step entirely it's also the fastest path.
Installing it
It ships in ComfyUI_Swwan, which bundles the RGBA Safe Pre/Post/Save/Multi Save set plus a pile of other migrated nodes. Install via Manager (search "ComfyUI_Swwan") or:
cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
pip install -r ComfyUI_Swwan/requirements.txt
Where people get burned
The classic mistake is feeding this node raw Load Image output - it needs Pre's alpha and has_alpha, not just the image. If you wire it without those, alpha handling silently degrades. Also remember the multi-save is a final node: it has no image output, so if you need corrected RGB and alpha to continue into more processing, put RGBA Safe Post in the middle and use this only at the end. And if you're still seeing fringe after saving: check that the intermediate nodes actually passed the premultiplied RGB through unchanged - anything that rescales color will wreck the premultiply relationship, which is exactly the "divide-by-zero and overbright edges" case epsilon was built to soften.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Processed image. If it comes from RGBA Safe Pre, it is usually still premultiplied. | |
| alpha | MASK | Alpha from RGBA Safe Pre. It will be resized automatically to the current image size. | |
| has_alpha | BOOLEAN | Boolean flag from RGBA Safe Pre. Used by auto mode to decide whether alpha should be kept. | |
| file_format | COMBO | png | Output file format. JPEG never keeps alpha. PNG and WebP can keep alpha. |
| alpha_mode | COMBO | auto | auto: keep alpha only for PNG/WebP when has_alpha is true. keep: force alpha-capable save. flatten: composite over background color and save RGB only. |
| filename_prefix | STRING | RGBA | Filename prefix for saved files. |
| epsilonopt | FLOAT | 0.00100.000001–0.1 | Only used when alpha is kept. Prevents divide-by-zero and overbright edges during unpremultiply. |
| background_redopt | FLOAT | 1.000–1 | Background red channel used when flattening alpha to RGB. |
| background_greenopt | FLOAT | 1.000–1 | Background green channel used when flattening alpha to RGB. |
| background_blueopt | FLOAT | 1.000–1 | Background blue channel used when flattening alpha to RGB. |
| jpeg_qualityopt | INT | 951–100 | JPEG encoder quality. Higher values keep more detail and larger files. |
| webp_qualityopt | INT | 901–100 | WebP quality used in lossy mode. |
| webp_losslessopt | BOOLEAN | false | Enable lossless WebP encoding. Usually larger but preserves pixels better. |
| png_compress_levelopt | INT | 40–9 | PNG compression level. Higher values reduce size but may save slower. |
Outputs (0)
No outputs