Easy HDR VAE Encode (Koolook)
Easy HDR VAE Encode
- pixels
- vae
- samples
- debug_info
- alpha
The stock VAEEncode assumes your pixels are already in the right range. Easy HDR VAE Encode is for when they're not - when you're feeding it ACES, or cinema log, or an HDR EXR whose values go past 1.0 and would get crushed into nothing by a naive encode.
Think of it as the intake desk for a VFX pipeline. You tell it what color space your source is in, it converts to scene-linear, applies an exposure step, handles the out-of-range values so highlights don't silently flatten, and then does the ordinary VAE encode. Your video or image comes out the other side as a latent that actually preserves what the source meant. The matching Easy HDR VAE Decode puts it back.
Like its decode sibling, it's a slim fork of the Radiance VAE4K nodes, minus the 4K tile engine that errored on Wan 2.2 video. It routes straight into vae.encode() and lets image or video VAEs do their own thing - so this one node covers SD 1.5/SDXL, Flux, Wan, Hunyuan, CogVideoX, and LTX without a separate code path.
The settings that matter
- source_space - what you're bringing in. sRGB for the obvious case, Linear for renders, ARRI LogC3 / Sony S-Log3 / Panasonic V-Log / RED Log3G10 for camera footage, ACEScg and friends for pipeline work. This drives the conversion into scene-linear Rec.709 before anything else happens.
- hdr_mode - how out-of-range values get handled before encode:
Clip (SDR)crushes,Soft Cliprolls off gently (the default, and a good default),Compress (Log)squeezes HDR into log range,Passthroughskips the handling. Remember what you picked - decode wants the same value for a clean roundtrip. - exposure - stops, applied after color conversion. Negative to bring HDR highlights into range, positive to push a dark plate up.
- latent_sampling -
sample(random, the default) vs.mean/mode(deterministic). For round-trip and test workflows where you want bit-identical results, mean or mode is your friend. - alpha_handling -
Preservekeeps a real 4th-channel alpha and surfaces it on thealphaoutput;Ignoreemits a blank one. If you're doing compositing work, wirealphaout and don't lose it.
Outputs are samples (the LATENT), debug_info (string), and alpha (IMAGE).
Install
Ships in ComfyUI-Koolook. Manager → Install Custom Nodes → Git URL:
https://github.com/malkuthro/ComfyUI-Koolook.git
Or clone:
cd ComfyUI/custom_nodes
git clone https://github.com/malkuthro/ComfyUI-Koolook.git
Restart, find it under Koolook/VAE. No downloads beyond the pack itself. One house rule from the README: install it once. If Manager installed it as custom_nodes/koolook/, don't git clone a second copy alongside - two installs both register and the plugin's workflow store starts corrupting on every restart until you delete one.
Common issues
- Encode/decode roundtrip shifts color -
hdr_mode(andsource_spacefor Compress-Log) don't match between the two nodes. It's the most common gotcha and the tooltips on both sides call it out. - Flat or crushed highlights on HDR input -
hdr_modeis set toClip (SDR)on a source that goes past 1.0. Switch to Soft Clip or Compress (Log). - Alpha disappears -
alpha_handlingis onIgnore, or you didn't wire thealphaoutput. It's a separate output for a reason.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | — | |
| vae | VAE | — | |
| source_space | COMBO | Linear | Input color space. Converted to scene-linear Rec.709 before exposure and HDR handling. |
| exposureopt | FLOAT | 0.0-10–10 | Exposure in stops, applied after color conversion. |
| alpha_handlingopt | COMBO | Preserve | Preserve input alpha, or emit blank alpha. |
| hdr_modeopt | COMBO | Soft Clip | Out-of-range handling before encode. Match this setting on decode for roundtrips. |
| latent_samplingopt | COMBO | sample | sample is random; mean/mode are deterministic. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| samples | LATENT | — |
| debug_info | STRING | — |
| alpha | IMAGE | — |