Nodes/ComfyUI-piFlow/Oklab Color Encoder
ComfyUI Node

Oklab Color Encoder

The fake VAE that pixel-space models actually need

By Lakonik·Created 10 months ago·Updated 23 days ago· 186
Oklab Color Encoder
    • VAE
    use_affine_normtrue
    mean_l0.560
    mean_a0.000
    mean_b0.010
    std0.160

    Oklab Color Encoder builds a color-space encoder/decoder that speaks ComfyUI's VAE type so pixel-space AsymFlow models can ride the normal pipeline. It doesn't load weights, it doesn't need a model file - it creates a tiny codec object that converts between sRGB pixels and the Oklab color space AsymFLUX.2 was trained in, and it plugs into anything that expects a VAE: VAE Encode, VAE Decode, Pixel Preview, Clamp Denoised.

    Why it exists: AsymFlow models skip the latent space entirely and denoise actual pixels, but ComfyUI still routes images through "encode → sample → decode." This node is the stand-in VAE that makes that plumbing work without an actual neural VAE. In the AsymFLUX.2 workflow you can see the whole shape of it - an EmptyImage gets encoded through the Oklab codec, the sampler denoises in Oklab space, and the result is decoded back to sRGB for display. The node's own description says exactly this: "Creates an Oklab color encoder/decoder compatible with ComfyUI VAE Encode and VAE Decode nodes."

    The inputs

    Every input is optional, which tells you something: the defaults are the training normalization for AsymFLUX.2, and you should leave them alone unless you're doing something exotic.

    • use_affine_norm - true by default. Applies the mean/std normalization below to the Oklab values; this is what the model expects.
    • mean_l (0.56), mean_a (0), mean_b (0.01) - the per-channel means of the affine normalization.
    • std (0.16) - the shared standard deviation.

    Under the hood it's the standard Oklab transform: sRGB → linear RGB → LMS → cube-root → Oklab, then affine normalization. Decode runs it backwards. One output: a VAE you wire into the graph.

    Where it goes

    In the shipped AsymFLUX.2 workflow this one node feeds four sockets: VAE Encode (from EmptyImage), VAE Decode (to SaveImage), Pixel Preview (for accurate live previews), and Clamp Denoised (to keep denoised pixels in range). If you're hand-building an AsymFlow graph and skip it, you'll have nothing to feed VAEDecode and the whole thing stalls.

    Install

    Ships with the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Lakonik/ComfyUI-piFlow
    

    Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI-piFlow"). Requires ComfyUI 0.17.0+ and, notably, this is a newer addition - the pack only shipped it with the AsymFlow release in mid-2026, so make sure you're on a current version of the pack itself, not just ComfyUI. No dependencies, no downloads, no GGUF wiring - it's pure arithmetic in a node.

    Where people get confused: thinking this replaces a real VAE for latent-space models. It doesn't - it's the pixel-space stand-in. If you plug it into a pi-Flow or Flux workflow expecting it to decode latents, you'll get nonsense. It belongs exclusively to the AsymFlow side of this pack.

    CategoryLakonLab

    Inputs (5)

    NameTypeDefaultDescription
    use_affine_normoptBOOLEANtrue
    mean_loptFLOAT0.560-10–10
    mean_aoptFLOAT0.000-10–10
    mean_boptFLOAT0.010-10–10
    stdoptFLOAT0.1600.0001–10

    Outputs (1)

    NameTypeDescription
    VAEVAE