◎ Radiance VAE Encode
VAE encode that survives 4K, float images, and a round-trip
- pixels
- vae
- samples
- alpha
- metadata
- latent_format
- quality_report
ComfyUI's plain VAE Encode does one job and does it fine: image in, latent out. The moment your image is big, float, or needs to survive a round-trip, it starts to hurt. ◎ Radiance VAE Encode is the pack's production version: it tiles big images so 4K+ encodes don't OOM, understands 11 color spaces, can preserve alpha, and tracks what it did so the decode side can undo it cleanly.
The KB's VAE essay is the right context here: the VAE is the compressor between pixel space and latent space, and newer models carry more channels per latent (Flux/SD3 = 16, SDXL = 4). This node's job is to make that conversion precise and repeatable at sizes where the stock node falls over - plus it gives you control over how the latent is sampled, which matters for img2img.
How it works
The core is production tiling: the image is split into tiles (with overlap for cosine blending so seams are invisible), each tile is padded to a VAE-friendly size and encoded, and the latents are stitched back. tile_size defaults to Auto, which queries your VRAM and picks a safe size - that's the anti-OOM magic. overlap (default 128) is the blend width between tiles.
Three things make it different from the stock node. First, color-space awareness: source_space (Linear, ACEScg, sRGB, ARRI LogC3/LogC4, S-Log3, V-Log, etc.) linearizes input correctly before encoding, so float/HDR sources don't get mangled. Second, latent_sampling: sample (default, the standard stochastic draw), mean (deterministic, lowest-noise - the doc's recommendation for img2img), or mode. Third, alpha: alpha_handling can preserve the alpha channel through encode and hand it back out for a round-trip.
There's also the hdr_mode menu (Clip (SDR) / Soft Clip / Compress (Log) / Passthrough) that decides how out-of-range values are handled before encode - the v2.3 Compress (Log) path pushes scene-linear range through a log curve with no post-encode clamp, and the decode side is built to invert it.
The inputs that matter
pixelsandvae- required, the obvious pair.source_space- set it to what your pixels actually are. DefaultLinear; choose sRGB for normal images, a log curve for footage.tile_size-Autounless you're hunting VRAM edges.latent_sampling-meanfor deterministic img2img,samplefor generation.
Outputs: samples (the latent → Sampler Pro), alpha (alpha tensor → decode), metadata (JSON → decode's crop_padding for auto-crop), latent_format (string like flux_16ch → Sampler Pro's latent_format), and quality_report (clipping %, NaN count, latent range - the honest "did anything break" tell).
How to install it
It's in the radiance pack. ComfyUI Manager → "Radiance", or:
cd ComfyUI/custom_nodes
git clone https://github.com/fxtdstudios/radiance.git
cd radiance
pip install -r requirements_windows.txt
Restart, and it's under FXTD Studios/Radiance/Generate.
Common issues
The big one is matching encode and decode modes: hdr_mode and source_space must agree on both sides of the chain, or your round-trip comes back wrong-colored. The pack's own tooltip warns the Compress (Log) path specifically needs the matching decode settings. Second: mean sampling gives cleaner, more deterministic encodes but less variety - don't blame the node if mean outputs feel flatter; that's the tradeoff it's named for. And as with everything in this pack, garbage in, garbage out: encoding an 8-bit PNG with Compress (Log) won't conjure HDR highlight detail that isn't there. If you're feeding it HDR, feed it HDR.
For anyone doing img2img, inpainting, or HDR round-trips at scale, the tiling alone is worth the install - the stock node's OOM on 4K is the kind of error that ends a session.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | — | |
| vae | VAE | — | |
| source_space | COMBO | Linear | Input color space. Auto-linearized before VAE encode. |
| tile_sizeopt | COMBO | Auto | Tile size in pixels. Auto queries VRAM. |
| overlapopt | INT | 12832–256 | Overlap between tiles in pixels. 128px optimal for cosine blending. |
| exposureopt | FLOAT | 0.0-10–10 | Exposure adjustment in stops (linear space). |
| alpha_handlingopt | COMBO | Preserve | Preserve alpha channel for roundtrip. |
| hdr_modeopt | COMBO | Soft Clip | HDR handling before VAE encode. |
| latent_samplingopt | COMBO | sample | How to sample from the VAE posterior distribution. 'mean' gives deterministic, lowest-noise results for img2img. 'sample' gives diverse outputs (default ComfyUI behaviour). |
| processing_modeopt | COMBO | sequential | 'sequential' uses minimal VRAM (one tile at a time). 'batched' groups tiles for 2-4x faster encode on high-VRAM GPUs. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| samples | LATENT | Encoded latent — wire to Sampler Pro or save node. |
| alpha | IMAGE | Alpha channel tensor — wire to Radiance VAE 4K Decode alpha input. |
| metadata | STRING | Encode metadata JSON — wire to Decode crop_padding for auto-crop. |
| latent_format | STRING | Latent format string (e.g. 'flux_16ch') — wire to Sampler Pro latent_format input. |
| quality_report | STRING | Quality metrics JSON: clipping %, NaN count, latent range, tile info. |