BSZ Latent RGBA Image
Encode a solid color into a latent with your own VAE
- vae
- LATENT
The pack's other colored-latent node, BSZ Colored Latent Image XL, gives you eight fixed colors with hardcoded constants. BSZ Latent RGBA Image gives you any color - red, green, blue channels plus an alpha for how strongly the color saturates the latent - by actually encoding a solid-color image with the VAE of your choice. It costs a VAE encode, and it buys you infinite palette.
Why you'd reach for it
You want to start a generation from a specific tint, or you're building the "injection" latent for the pack's experimental sampler and you want a precise color rather than one of the eight presets. Because it encodes through whatever VAE you provide, it also works on models where the hardcoded preset node doesn't - you're not locked to SDXL's baked-in constants.
Inputs
vae- the VAE used to encode the color into latent space. Use the one matching your checkpoint.r,g,b- color channels, each 0.0 to 1.0.a- alpha, 0.0 to 1.0. Zero produces an all-zero (empty) latent; 1.0 is a fully saturated color latent.width,height,batch_size- size and count, same asEmptyLatentImage.
Output: a LATENT.
How it works
The node builds a full-size image where every pixel is your RGB color, VAE-encodes it, scales the latent by a, and expands it to your batch size. If a is below 0.01 it short-circuits and returns a plain zero latent, so you can drive alpha down to "empty" without paying the encode cost. That's the mechanism - a real encode of a real (solid) image, not hardcoded channel values.
The trap the README warns about
Don't assume 0.5, 0.5, 0.5 with alpha 0 equals an empty latent - the author calls it out explicitly: "even though 0.5, 0.5, 0.5 seems like it should be equal to an empty latent, in reality it is not and seeds will be very different." Mid-gray is not the same as the VAE's actual latent-space zero point. If you want a clean empty latent, use a = 0 (which returns true zeros) or stock EmptyLatentImage.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Beinsezii/bsz-cui-extras
then restart, or install via ComfyUI Manager. Pure Python, no dependencies - the only "dependency" is a VAE, which you already have. Pair it with the HSVA flavor if you think in hue/saturation/value instead of RGB; the two share everything but the input sliders.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | — | |
| r | FLOAT | 0.000–1 | — |
| g | FLOAT | 0.000–1 | — |
| b | FLOAT | 0.000–1 | — |
| a | FLOAT | 0.500–1 | — |
| width | INT | 102416–16384 | — |
| height | INT | 102416–16384 | — |
| batch_size | INT | 11–4096 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |