Nodes/ComfyUI-bleh/BlehImageAsLatent
ComfyUI Node

BlehImageAsLatent

Point latent-space tools at a regular image

By blepping·Created 3 years ago·Updated 4 days ago· 143
BlehImageAsLatent
  • image
  • LATENT
rescaletrue

A small, single-purpose utility: it makes ComfyUI treat a regular IMAGE tensor as if it were a LATENT, purely by reshaping and relabeling - no VAE encode happens anywhere in the process. The point is to let latent-space tooling (bleh's own latent blend, scale, and ops nodes among them) operate on ordinary pixel data instead of a genuine diffusion-model latent.

That's worth stressing because it's easy to misread: this is not a VAE encode substitute. What you get back typed as LATENT is your image tensor reshaped to fit the slot, not a real compressed latent representation your model was trained to understand. Feed it into a KSampler expecting an actual encoded latent and you'll get nonsense - this node exists to let you route an image through latent-shaped tools, not to prepare an image for generation.

The one setting that actually matters is rescale (default true). IMAGE tensors in ComfyUI are normally valued 0 to 1; latents commonly run roughly -1 to 1. Leaving rescale on remaps the image's value range to match what latent-space math expects, so operations built for latents behave sensibly instead of clipping or producing washed-out garbage on data that's numerically in the wrong range for them.

It's designed to be reversible: BlehLatentAsImage does the exact inverse rearrangement. The typical round trip looks like encode with this node → run whatever latent-space operation you actually wanted (one of bleh's blend or filter nodes, for instance) → decode back with BlehLatentAsImage to get a normal image out the other end.

Inputs: image (required IMAGE), rescale (default true). Output: LATENT.

A concrete way to think about when this earns its place in a graph: bleh ships its own latent blend and scaling nodes with a much wider range of blend modes and interpolation types than ComfyUI's stock latent tools - dozens of options beyond the usual handful. If you want to apply one of those to a plain image (blending two photos with hslerp instead of a simple crossfade, say, or running one of bleh's filter-style operations on pixel data), you don't have an image-space equivalent to reach for. Rather than write a separate implementation of the same math for IMAGE tensors, this node lets you borrow the latent-space version directly.

Install is the standard route for the pack - ComfyUI Manager, or a manual git clone https://github.com/blepping/ComfyUI-bleh into custom_nodes plus a restart. No extra dependencies.

The practical use case is narrower than it might sound: reach for this when you specifically want to apply latent-shaped tooling - a blend mode, a filter, a scaling operation from this same pack - to image data, and there's no equivalent image-space version of that operation available. It's not a general-purpose bridge for anything image-related, and it's specifically not a way to skip a proper VAE encode when you actually need one.

Categorylatent/advanced

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
rescaleBOOLEANtrueWhen enabled, will rescale the image values which usually are from 0 to 1 to -1 to 1.

Outputs (1)

NameTypeDescription
LATENTLATENT