Nodes/petty-paint-comfyui-node/Skippable VAEEncode
ComfyUI Node

Skippable VAEEncode

A VAE encode that can bail out when there's nothing new to feed it

By mephisto83·Created 2 years ago·Updated 2 years ago· 3
Skippable VAEEncode
  • pixels
  • vae
  • skip
  • LATENT
  • BOOLEAN

In a normal img2img workflow you always have a new image to encode, so a plain VAEEncode is fine. In the petty-paint loop, though, the image on the canvas only changes when the iPad sends something new - and re-encoding the same pixels every queue wastes a VAE pass for nothing. Skippable VAEEncode is the fix: same encoding as the built-in node, plus a skip flag that lets the whole pipeline stand down when there's genuinely nothing new. It's the front half of the pack's "skip chain," paired with PPKSamplerAdvanced and PettyPaintVAEDecode.

How it works

The inputs are pixels (the IMAGE to encode) and vae (your VAE), same as the stock node, plus an optional skip input that accepts any truthy value. When skip is off, it runs ComfyUI's standard VAEEncode under the hood and returns the encoded latent - identical output to the built-in node. When skip is on, it returns early with a latent whose samples are None instead of running the encoder at all.

That samples: None latent is the important detail. It's not a valid latent you can sample from - it's a placeholder meaning "nothing happened here." If you feed it into a normal KSampler it will fail, because there's no actual tensor to work with. The skip path only makes sense when the rest of the pipeline is also skipping: SkippableVAEEncodePPKSamplerAdvanced (with its own skip) → PettyPaintVAEDecode (with its own skip). Together they short-circuit an entire generation when the iPad hasn't produced new art, and the image just flows through.

The outputs that matter

  • LATENT - the encoded latent, or the None-samples placeholder when skipped.
  • BOOLEAN - passes the skip state through, so a downstream node can see whether this pass actually encoded. In the skip branch the node returns only the latent, so treat that second output as best-effort rather than guaranteed.

When you'd use it (and when you shouldn't)

If you're in the iPad pipeline, this is your encode node - the skip chain is how the pack avoids burning GPU on idle runs. If you're not, just use the built-in VAEEncode. This one's only advantage is the skip flag, and a skip flag you never set is pure indirection.

Installing it

It ships in the petty-paint pack: ComfyUI Manager search "Petty Paint", or:

cd ComfyUI/custom_nodes
git clone https://github.com/mephisto83/petty-paint-comfyui-node

then restart ComfyUI. No models to download; the pack's only pinned requirement (Flask) isn't imported by the current source, so nothing heavy installs.

Gotchas

The classic mistake is skipping the encode but not the sampler: you get the None-samples latent, it hits a normal KSampler, and the queue dies with a tensor error that doesn't obviously point back here. If you see that, the first thing to check is whether skip got tripped. And remember skip is an any input - a stale True from an old run's state is all it takes to silently turn your encode into a placeholder.

CategoryPettyPaint

Inputs (3)

NameTypeDefaultDescription
pixelsIMAGE
vaeVAE
skipopt*

Outputs (2)

NameTypeDescription
LATENTLATENT
BOOLEANBOOLEAN