> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# VAE编码（VAEEncode）

<div class="node-meta"><code>VAEEncode</code><span>model/latent</span><span>角色：图像编码</span><span class="star">★ 常用节点</span></div>

此节点用于使用指定的 VAE 模型将图像编码为潜在空间表示。它抽象了编码过程的复杂性，提供了一种将图像转换为其潜在表示的直观方法。

## 参数

| 参数       | 类型         | 默认 / 范围 | 说明                                                            |
| -------- | ---------- | ------- | ------------------------------------------------------------- |
| `pixels` | IMAGE · 图像 | —（连线输入） | IMAGE。                                                        |
| `vae`    | VAE · 自编码器 | —（连线输入） | `vae` 参数指定用于将图像数据编码到潜在空间中的变分自编码器模型。它对于定义编码机制以及所生成潜在表示的特性至关重要。 |

## 输出

| 输出  | 类型     | 说明  |
| --- | ------ | --- |
| 潜空间 | LATENT | 潜空间 |

## 怎么接

- **上游**：LoadImage / VAEDecode
- **下游**：VAEDecode / 下一段采样
- **接线**：把 LoadImage / VAEDecode 出来的 IMAGE 接到 `image`，同家族 VAE 接到 `vae`；输出 LATENT 送进 KSampler 的 `latent_image`——配合 0.4-0.7 的降噪强度就是图生图，先接 SetLatentNoiseMask 则变成局部重绘。

## 使用案例

把图片编码成潜空间，图生图的关键一步。`pixels` 接图片，`vae` 接同一个底模的 VAE。

编码后的 latent 尺寸由原图决定，所以图生图里**不要再接 EmptyLatentImage**，接了会把尺寸覆盖掉。

`denoise` 越小越接近原图：0.3 修质感，0.5 换风格，0.7 以上基本重画。

## 端口与连线示意

![VAEEncode 端口与连线示意](/svg/VAEEncode.svg)

## 实战提示

- 图生图记得把降噪强度调低于 1，否则等于完全重绘。

## 同类节点

[空Latent图像](/nodes/04/EmptyLatentImage.md) · [合成Latent](/nodes/04/LatentComposite.md) · [合成Latent遮罩](/nodes/04/LatentCompositeMasked.md) · [缩放Latent](/nodes/04/LatentUpscale.md) · [缩放Latent（比例）](/nodes/04/LatentUpscaleBy.md) · [加载Latent](/nodes/04/LoadLatent.md) · [保存Latent](/nodes/04/SaveLatent.md) · [设置Latent噪波遮罩](/nodes/04/SetLatentNoiseMask.md) · [VAE解码](/nodes/04/VAEDecode.md) · [VAE解码（分块）](/nodes/04/VAEDecodeTiled.md) · [VAE编码（局部重绘）](/nodes/04/VAEEncodeForInpaint.md) · [空Latent音频](/nodes/04/EmptyLatentAudio.md)
