Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Image to Latent (simplified)
ComfyUI Node

๐ŸฆŠ RS Image to Latent (simplified)

The 'just encode it' image-to-latent node โ€” zero size settings to touch

By RaykosanยทCreated about a year agoยทUpdated 4 days agoยท 79
๐ŸฆŠ RS Image to Latent (simplified)
  • image
  • vae
  • latent
  • width_px
  • height_px
โ—„batch_size1โ–บ

You know how the full RS Image to Latent node has modes, divisibility options, rounding strategies, and four upscale methods? This is the version for everyone who just wants the image encoded. ๐ŸฆŠ RS Image to Latent (simplified) (RS_ImageToLatent_Simplified) takes an image and a VAE, does the size-multiple fix automatically, and returns the latent plus the pixel dimensions. The only control you get is batch_size. That's the entire point.

How it works

Despite the minimal UI, it does real work. On first run it probes the connected VAE by encoding a tiny test tensor to discover the actual downscale factor (it divides 64 by the resulting latent height - so an 8x VAE yields 8, a 16x VAE yields 16, and so on), and caches that result. Then it rounds your image's dimensions to the nearest multiple of that factor, resizes via Lanczos if anything changed, and - only if the size was already valid - encodes directly without resizing, which the README notes avoids a wasteful round-trip. Alpha is stripped if present (RGBA โ†’ RGB) before encoding. It returns:

  • latent - the encoded tensor.
  • width_px, height_px - the final pixel dimensions after rounding (so you know what actually got encoded).

There's no mode, no preset, no rounding_mode - the size is always "preserve the image, rounded to what the VAE needs." That's the whole simplified contract.

Inputs that matter

  • image - input to encode.
  • vae - the VAE (it auto-detects divisibility).
  • batch_size - 1 to 64; repeats the same latent into a batch.

How to install

Part of ComfyUI_RaykoStudio:

cd ComfyUI/custom_nodes
git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git

Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI_RaykoStudio"). No extra dependencies.

Common issues

  • I wanted a different size! This node won't upscale or downscale to a target - it only rounds. If you need to force a specific resolution, use the full RS_ImageToLatent node with preset/custom/megapixels mode.
  • Width/height outputs look unexpected. They reflect the rounded size, which may differ by a few pixels from your input. That's the feature, not a bug.
  • RGBA input surprise. Alpha is dropped before encoding - expected for image generation, worth knowing if you were hoping to preserve transparency through the latent.

The honest take: this is the right default choice for img2img and inpainting if you don't care about resolution control. The full node isn't scary, but this one removes every decision and still solves the divisibility problem - which is what most people were hitting the full node for anyway. If you find yourself leaving everything at default, you're the audience for this one.

Category๐ŸฆŠ RaykoStudio

Inputs (3)

NameTypeDefaultDescription
imageIMAGEInput image to convert to latent
vaeVAEVAE model for encoding
batch_sizeINT11โ€“64Number of identical latents in batch

Outputs (3)

NameTypeDescription
latentLATENTโ€”
width_pxINTโ€”
height_pxINTโ€”