๐ฆ RS Image to Latent (simplified)
The 'just encode it' image-to-latent node โ zero size settings to touch
- image
- vae
- latent
- width_px
- height_px
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_ImageToLatentnode 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.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image to convert to latent | |
| vae | VAE | VAE model for encoding | |
| batch_size | INT | 11โ64 | Number of identical latents in batch |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | โ |
| width_px | INT | โ |
| height_px | INT | โ |