RGBA Save (Swwan)
The dedicated PNG writer that finally keeps your transparency
- image
- alpha
ComfyUI's built-in Save Image throws away alpha, full stop. If you've ever cut out a subject, done a clean pass, and then watched the exported PNG come out on a black background, you know exactly what this node is for. RGBA_Save is the pack's dedicated transparent-PNG writer: it takes the RGB and the alpha mask separately and combines them into a real RGBA file.
It's deliberately single-purpose. No JPEG, no WebP, no format switching - you want this node when the output must be a transparent PNG, and you use the pack's RGBA_Multi_Save when you need to flip formats. That narrowness is a feature: one less thing to misconfigure.
Where it sits in the workflow
It's the terminal node of the pack's transparency pipeline:
Load Image → RGBA Safe Pre → (RGB-only nodes) → RGBA Safe Post → RGBA Save
RGBA_Safe_Pre premultiplies your RGB (so intermediate nodes don't smear fringes into the image), and RGBA_Safe_Post restores straight color and resizes the alpha. RGBA_Save then merges the corrected RGB with that alpha into the PNG. If you feed it premultiplied RGB directly, the saved file will look too dark at semi-transparent edges - that's the tooltip's warning in action: use RGBA_Safe_Post first if the image is still premultiplied.
Inputs
Three inputs, and you already have all of them if you followed the pipeline:
image(IMAGE) - the RGB to save, ideally theimage_outfromRGBA_Safe_Post.alpha(MASK) - the alpha to embed, ideally thealpha_outfrom Post. If its resolution doesn't match the image, the node resizes it to fit, so mismatched sizes don't crash it.filename_prefix(STRING, default"RGBA") - the prefix for the saved files. Files land in ComfyUI'soutput/folder with the standardprefix_counter.pngnaming.
How it works
Under the hood it does the boring-but-important bookkeeping you expect from a save node: it resolves the output path, stacks the RGB and alpha into an RGBA array, and writes it with PIL. It also embeds the workflow/prompt metadata into the PNG like ComfyUI's normal save does (unless you run ComfyUI with metadata disabled), so the file stays portable and re-loadable. png_compress_level is fixed at 4 - you won't find a quality knob here, which is fine; PNG's lossless anyway.
Install
It ships in ComfyUI_Swwan. ComfyUI Manager → search "ComfyUI_Swwan", or:
cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
cd ComfyUI_Swwan
pip install -r requirements.txt
Restart, then find RGBA Save (Swwan) under Swwan/RGBA.
The traps
The big one: don't skip the Post step. The most common "why is my saved PNG dark at the edges" post is someone feeding premultiplied RGB straight into a save. If your output looks like the subject got a permanent shadow around the outline, that's the double-alpha problem, and Post is the fix.
Second, this is PNG-only, and it will happily ignore that you wanted a JPEG. If you need format flexibility (or a flattened "no transparency" export for thumbnails or training sets), that's RGBA_Multi_Save's job, not this node's.
Third, remember the save happens against whatever alpha you give it. If you skipped RGBA_Safe_Pre entirely and loaded the raw inverted mask from Load Image as your alpha, you'll write a PNG where the subject is transparent and the background is solid. The mask from Load Image is 1 - alpha - this node trusts your alpha, it won't fix your wiring.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | RGB image to save as PNG. Use RGBA Safe Post first if the image is still premultiplied. | |
| alpha | MASK | Alpha mask to embed into the saved PNG. | |
| filename_prefix | STRING | RGBA | Filename prefix for the saved PNG files. |
Outputs (0)
No outputs