SDNQ VAE Encode
The adapter that lets ComfyUI talk to a diffusers VAE
- pixels
- vae
- latent
Img2img with the comfyui-sdnq-splited pack has a hidden incompatibility: your image needs to become a latent, but ComfyUI's stock VAEEncode expects a ComfyUI VAE, and this pack's models come with a diffusers VAE that speaks a different format. ComfyUI hands images around as [N, H, W, C] tensors; the diffusers VAE wants [N, C, H, W] and returns a LatentDict rather than a bare tensor. SDNQ VAE Encode is the translation layer that makes the two sides talk.
That's the whole job, and it's a fiddly one done well. It takes an image in ComfyUI format, permutes it to the layout the diffusers VAE expects, coerces everything to float32 (ComfyUI's VAEEncode contract), and returns a [N, C, H, W] latent in the standard ComfyUI latent dict. It also patches the VAE's decode path to force float32 input - the fix that keeps bfloat16/float bias mismatches from producing muddy, color-shifted decodes on Flux2 models. If you've ever piped a diffusers VAE through the stock nodes and watched it silently produce garbage, this is the reason the pack ships its own.
Inputs and output
Only two inputs, both required, both obvious:
pixels(IMAGE) - your source image in ComfyUI's[N, H, W, C]format, typically from a LoadImage node. It strips alpha, so RGBA sources are fine.vae(VAE) - thevaeoutput of SDNQ Model Loader, which is precisely the diffusers VAE wrapped for this purpose. The tooltip notes it also accepts a standard ComfyUI VAE, but in practice you'll use the loader's.
The single output, latent (LATENT), feeds the latent_image input of Flux2 SDNQ Sampler V2 or SDNQ Sampler V2 - where it also determines the output resolution, since the samplers read width and height off that tensor. Wire order: SDNQ Model Loader → SDNQ VAE Encode → Sampler.
Install
Standard pack install:
cd ComfyUI/custom_nodes/
git clone https://github.com/ussoewwin/comfyui-sdnq-splited.git
cd comfyui-sdnq-splited
pip install -r requirements.txt
Restart ComfyUI; it appears under latent/SDNQ. If you install via Manager and hit the security-level message, lower the Security Level or use "Install via Git URL" with the repo above.
Troubleshooting
The classic failure mode is feeding it a mismatched VAE: if the loader's vae output isn't what you plugged in, the encode can return odd shapes or the sampler downstream complains about latent dimensions. And because the samplers take their resolution from the latent, an upscaled or oddly-cropped input image will show up as a resolution surprise at generation time - the Flux2 sampler's 1.0.2 fix made it respect input size rather than clamping to 1024×1024, but it still needs the encode to produce a sane tensor. If your i2i output looks like the input was ignored entirely, suspect the denoise value on the sampler before you suspect this node - the encode itself is the boring, reliable part.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | Image tensor in ComfyUI format [N, H, W, C] | |
| vae | VAE | VAE model (diffusers VAE wrapped in ComfyVAEWrapper or standard ComfyUI VAE) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |