Nodes/comfyui-alphavae/AlphaVAE Decode (RGBA)
ComfyUI Node

AlphaVAE Decode (RGBA)

Where FLUX's transparent pixels finally land in your hands

By katsut·Created 5 months ago·Updated about a month ago· 1
AlphaVAE Decode (RGBA)
  • samples
  • alpha_vae
  • image
  • alpha

You know the standard transparent-image pipeline: generate an opaque picture, then run BiRefNet or rembg over it and pray the hair survives. AlphaVAE Decode (RGBA) is the "stop praying" option - it turns a FLUX latent into a cutout with the alpha baked in during generation, so nothing has to be guessed afterwards. It's the payoff node of the katsut/ComfyUI-AlphaVAE pack.

This is the FLUX-era answer to LayerDiffusion. LayerDiffusion got native transparency working on SDXL and then died, unmaintained; AlphaVAE is a fine-tuned FLUX.1-dev VAE that decodes straight to RGBA (four channels instead of three), backed by a paper (arXiv:2507.09308) claiming better quality than LayerDiffuse. It's worth one honest caveat: this is early tooling with almost no community track record yet, so treat the README and your own tests as ground truth rather than hype.

How it works

During sampling, FLUX generates a latent with 16 channels - a normal FLUX VAE uses those to reconstruct RGB. AlphaVAE's VAE is trained so those same latents carry a fourth, alpha-like channel that encodes where things are transparent. AlphaVAEDecode is the part that unpacks it.

The mechanism details matter, mostly because the node does the fiddly bits for you. It calls the VAE decoder directly, bypassing diffusers' auto-scaling - ComfyUI's KSampler already handles latent scaling on its way in, so re-scaling here would double it. It shifts the decoded values from [-1,1] to [0,1], splits off the RGB channels, and then handles the pack's signature gotcha: AlphaVAE natively outputs inverted alpha (0 = opaque, 1 = transparent). The node flips that for you, so what comes out of the alpha port is a standard ComfyUI mask where 1 = opaque.

Inputs and outputs

Two inputs, two outputs, nothing to configure:

  • samples (LATENT) - the latent straight out of KSampler.
  • alpha_vae (ALPHA_VAE) - the handle from AlphaVAELoader.
  • image (IMAGE) - the RGB image, ready to wire into anything that takes an IMAGE.
  • alpha (MASK) - the transparency as a mask, 1 = opaque.

The natural wiring, straight from the README's example workflow, is:

AlphaVAELoader → AlphaVAEDecode → JoinImageWithAlpha → SaveImage
                                       ↑ (image + alpha → RGBA)

JoinImageWithAlpha merges the two outputs back into a single RGBA image, and SaveImage writes a PNG, which is the format that actually preserves alpha. From there you can also feed the mask into compositing, a mask blur, or a premultiply node - you've got both halves, so the graph is yours.

Installing it

ComfyUI Manager (search comfyui-alphavae) or:

cd ComfyUI/custom_nodes
git clone https://github.com/katsut/ComfyUI-AlphaVAE.git
pip install diffusers>=0.33.0

Restart after. Needs ComfyUI v0.18+ and diffusers 0.33+ (pinned 0.38+ in the project's pyproject.toml). Then download the pieces - roughly 36 GB all in: flux1-dev.safetensors (~12 GB, HF license agreement) into models/diffusion_models/, the AlphaVAE VAE folder (168 MB) into models/vae/AlphaVAE/finetune_VAE/, the AlphaVAE diffusion LoRA (1.3 GB) into models/loras/, and the clip_l + t5xxl_fp8 text encoders into models/clip/.

Common problems

  • Alpha comes out flat, around 0.5 - i.e. everything half-transparent and meaningless. You skipped the diffusion LoRA. This is the AlphaVAE failure mode. The LoRA is what teaches FLUX to write transparency into the latents; without it the VAE has no signal to decode, so you get a grey mush of an alpha. Load it with a LoraLoader at strength 1.0 on both the model and the CLIP paths, like the README's example workflow shows.
  • "Expected 4-channel VAE, got in_channels=3" at the loader. You pointed AlphaVAELoader at a stock FLUX VAE instead of the AlphaVAE folder. Fix the loader, not this node.
  • The image looks fine but the alpha edges are soft/blurry. That's often a sampling-settings thing. The README's reference settings are 20 steps, cfg 1.0, sampler euler, scheduler simple, with FluxGuidance at 3.5 - start there before you blame the VAE.
  • It errors when you feed it FLUX.2 output. By design. The weights are FLUX.1-dev-specific and the README states there's no FLUX.2 support planned.

One last thing, because it'll bite you later: the license. AlphaVAE weights descend from FLUX.1-dev's VAE, and the README flags that the non-commercial terms probably stick to them regardless of the AlphaVAE repo's stated license. Fine for personal use; get legal eyes on it before you ship anything commercial.

CategoryAlphaVAE

Inputs (2)

NameTypeDefaultDescription
samplesLATENT
alpha_vaeALPHA_VAE

Outputs (2)

NameTypeDescription
imageIMAGE
alphaMASK