Comfy-Org / Comfy-Org/ComfyUI

In-memory VAE decode for Preview-Image node

Open
#12,309 2 comments 1 reaction 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Feature Idea

## Description
Add a `VAE` input to the `KSampler` node so that, when connected, the latent output is decoded in memory and displayed in the `$$canvas-image-preview` widget. This allows users to preview the final decoded image without writing temporary files to disk. Right-click save should still work as usual. When no VAE is connected, `KSampler` behaves normally with latent previews.

The `VAE` input could connect directly to a standard VAE node, such as the integrated VAE from a checkpoint loader node. The `KSampler` VAE input essentially performs the VAE decode step for the canvas preview only, showing the user exactly what the final saved image would look like.

## Motivation
Currently, generating a VAE-decoded preview requires nodes like `SaveImage` or `PreviewImage` or any available output in general, which create disk writes even if the user only wants to preview the final image. The `$$canvas-image-preview` widget already shows images in memory, but it cannot display the VAE-decoded version without temporary files.

This feature would:
- Reduce unnecessary disk writes.
- Give users a true preview of the final image.
- Integrate seamlessly with existing nodes.
- Keep workflows minimal and ephemeral.

## Proposed Behavior
- **New input on `KSampler`: `VAE`**
- When connected:
- KSampler generates the latent as usual.
- The latent is decoded using the connected `VAE` node, identical to a standard VAE decode.
- The decoded image is sent directly to the canvas preview widget (`$$canvas-image-preview`).
- No latent output or disk write occurs.
- Right-click save works normally.
- When no `VAE` is connected: KSampler behaves exactly as it does today, showing the latent preview.

## Benefits
- Accurate, true-to-output previews without temporary files.
- Modular workflow: any standard VAE node can be connected.
- Maintains current in-memory latent preview behavior.
- Reduces unnecessary disk writes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.