Nodes/ComfyUI-Koolook/Easy HDR VAE Encode (Koolook)
ComfyUI Node

Easy HDR VAE Encode (Koolook)

Easy HDR VAE Encode

By malkuthro·Created 11 months ago·Updated about 21 hours ago· 8
Easy HDR VAE Encode (Koolook)
  • pixels
  • vae
  • samples
  • debug_info
  • alpha
source_spaceLinear
exposure0.0
alpha_handlingPreserve
hdr_modeSoft Clip
latent_samplingsample

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 Clip rolls off gently (the default, and a good default), Compress (Log) squeezes HDR into log range, Passthrough skips 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 - Preserve keeps a real 4th-channel alpha and surfaces it on the alpha output; Ignore emits a blank one. If you're doing compositing work, wire alpha out 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 (and source_space for 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_mode is set to Clip (SDR) on a source that goes past 1.0. Switch to Soft Clip or Compress (Log).
  • Alpha disappears - alpha_handling is on Ignore, or you didn't wire the alpha output. It's a separate output for a reason.
CategoryKoolook/VAE

Inputs (7)

NameTypeDefaultDescription
pixelsIMAGE
vaeVAE
source_spaceCOMBOLinearInput color space. Converted to scene-linear Rec.709 before exposure and HDR handling.
exposureoptFLOAT0.0-10–10Exposure in stops, applied after color conversion.
alpha_handlingoptCOMBOPreservePreserve input alpha, or emit blank alpha.
hdr_modeoptCOMBOSoft ClipOut-of-range handling before encode. Match this setting on decode for roundtrips.
latent_samplingoptCOMBOsamplesample is random; mean/mode are deterministic.

Outputs (3)

NameTypeDescription
samplesLATENT
debug_infoSTRING
alphaIMAGE