> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-recommend-assets-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ResizeImageMaskNode - ComfyUI Built-in Node Documentation

> Complete documentation for the ResizeImageMaskNode node in ComfyUI. Learn its inputs, outputs, parameters and usage.

> 本文档由 AI 生成。如果您发现任何错误或有改进建议，欢迎贡献！ [在 GitHub 上编辑](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/ResizeImageMaskNode/zh.md)

Resize Image/Mask 节点提供多种方法来改变输入图像或遮罩的尺寸。它可以通过缩放系数、设置特定尺寸、匹配另一输入的尺寸或基于像素数量进行调整，并使用多种插值方法来保证质量。

## 输入参数

| 参数             | 数据类型         | 必填 | 范围                                                                                                                                                                                 | 描述                                                                                         |
| -------------- | ------------ | -- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `input`        | IMAGE 或 MASK | 是  | N/A                                                                                                                                                                                | 待调整尺寸的图像或遮罩。                                                                               |
| `resize_type`  | COMBO        | 是  | `SCALE_BY`<br />`SCALE_DIMENSIONS`<br />`SCALE_LONGER_DIMENSION`<br />`SCALE_SHORTER_DIMENSION`<br />`SCALE_WIDTH`<br />`SCALE_HEIGHT`<br />`SCALE_TOTAL_PIXELS`<br />`MATCH_SIZE` | 用于确定新尺寸的方法。所需的参数会根据所选类型而变化。                                                                |
| `multiplier`   | FLOAT        | 否  | 0.01 到 8.0                                                                                                                                                                         | 缩放系数。当 `resize_type` 为 `SCALE_BY` 时必需（默认值：1.00）。                                           |
| `width`        | INT          | 否  | 0 到 8192                                                                                                                                                                           | 目标宽度（像素）。当 `resize_type` 为 `SCALE_DIMENSIONS` 或 `SCALE_WIDTH` 时必需（默认值：512）。                |
| `height`       | INT          | 否  | 0 到 8192                                                                                                                                                                           | 目标高度（像素）。当 `resize_type` 为 `SCALE_DIMENSIONS` 或 `SCALE_HEIGHT` 时必需（默认值：512）。               |
| `crop`         | COMBO        | 否  | `"disabled"`<br />`"center"`                                                                                                                                                       | 当尺寸与宽高比不匹配时应用的裁剪方法。仅在 `resize_type` 为 `SCALE_DIMENSIONS` 或 `MATCH_SIZE` 时可用（默认值："center"）。 |
| `longer_size`  | INT          | 否  | 0 到 8192                                                                                                                                                                           | 图像较长边的目标尺寸。当 `resize_type` 为 `SCALE_LONGER_DIMENSION` 时必需（默认值：512）。                        |
| `shorter_size` | INT          | 否  | 0 到 8192                                                                                                                                                                           | 图像较短边的目标尺寸。当 `resize_type` 为 `SCALE_SHORTER_DIMENSION` 时必需（默认值：512）。                       |
| `megapixels`   | FLOAT        | 否  | 0.01 到 16.0                                                                                                                                                                        | 目标总像素数（百万像素）。当 `resize_type` 为 `SCALE_TOTAL_PIXELS` 时必需（默认值：1.0）。                          |
| `match`        | IMAGE 或 MASK | 否  | N/A                                                                                                                                                                                | 一个图像或遮罩，输入将调整尺寸以匹配其尺寸。当 `resize_type` 为 `MATCH_SIZE` 时必需。                                  |
| `scale_method` | COMBO        | 是  | `"nearest-exact"`<br />`"bilinear"`<br />`"area"`<br />`"bicubic"`<br />`"lanczos"`                                                                                                | 用于缩放的插值算法（默认值："area"）。                                                                     |

**注意：** `crop` 参数仅在 `resize_type` 设置为 `SCALE_DIMENSIONS` 或 `MATCH_SIZE` 时可用且相关。当使用 `SCALE_WIDTH` 或 `SCALE_HEIGHT` 时，另一维度会自动缩放以保持原始宽高比。

## 输出参数

| 输出名称      | 数据类型         | 描述                      |
| --------- | ------------ | ----------------------- |
| `resized` | IMAGE 或 MASK | 调整尺寸后的图像或遮罩，其数据类型与输入一致。 |
