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

# OpenAIGPTImage1 - ComfyUI Built-in Node Documentation

> 通过 OpenAI 的 GPT Image 端点同步生成图像。

通过 OpenAI 的 GPT Image 端点同步生成图像。它可以根据文本提示词创建新图像，也可以在提供输入图像和可选 `mask` 时编辑现有图像。该节点支持 `gpt-image-1`、`gpt-image-1.5` 和 `gpt-image-2` 模型，并已标记为弃用。

## 输入

| 参数              | 描述                                                           | 数据类型   | 必需 | 范围                                                                                                                                                           |
| --------------- | ------------------------------------------------------------ | ------ | -- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `提示词`           | GPT Image 的文本提示词（默认值：""）                                     | STRING | 是  | -                                                                                                                                                            |
| `种子`            | 用于生成的随机种子；后端尚未实现（默认值：0）                                      | INT    | 否  | 0 到 2147483647                                                                                                                                               |
| `质量`            | 图像质量，影响费用和生成时间（默认值："low"）                                    | COMBO  | 否  | "low"<br />"medium"<br />"high"                                                                                                                              |
| `背景`            | 返回图像时是否包含背景（默认值："auto"）                                      | COMBO  | 否  | "auto"<br />"opaque"<br />"transparent"                                                                                                                      |
| `尺寸`            | 图像尺寸。选择 "Custom" 以使用自定义宽度和高度（仅 GPT Image 2）（默认值："auto"）      | COMBO  | 否  | "auto"<br />"1024x1024"<br />"1024x1536"<br />"1536x1024"<br />"2048x2048"<br />"2048x1152"<br />"1152x2048"<br />"3840x2160"<br />"2160x3840"<br />"Custom" |
| `数量`            | 要生成的图像数量（默认值：1）                                              | INT    | 否  | 1 到 8                                                                                                                                                        |
| `参考图像`          | 用于图像编辑的可选参考图像                                                | IMAGE  | 否  | -                                                                                                                                                            |
| `遮罩`            | 用于图像修复的可选遮罩（白色区域将被替换）                                        | MASK   | 否  | -                                                                                                                                                            |
| `模型`            | 要使用的 GPT Image 模型（默认值："gpt-image-2"）                         | COMBO  | 否  | "gpt-image-1"<br />"gpt-image-1.5"<br />"gpt-image-2"                                                                                                        |
| `custom_width`  | 仅当 `size` 为 "Custom" 时使用。必须是 16 的倍数（仅 GPT Image 2）（默认值：1024） | INT    | 否  | 1024 到 3840, step 16                                                                                                                                         |
| `custom_height` | 仅当 `size` 为 "Custom" 时使用。必须是 16 的倍数（仅 GPT Image 2）（默认值：1024） | INT    | 否  | 1024 到 3840, step 16                                                                                                                                         |

**参数约束：**

* 当提供 `image` 时，节点使用图像编辑端点。
* `mask` 只能在提供 `image` 时使用。
* 使用 `mask` 时，仅支持单张图像（批大小必须为 1）。
* `mask` 和 `image` 必须尺寸相同。
* 自定义分辨率（`size` = "Custom"）仅受 `gpt-image-2` 模型支持。
* 自定义宽度和高度必须是 16 的倍数。
* 自定义分辨率的最长边必须小于或等于 3840。
* 自定义分辨率的宽高比不得超过 3:1。
* 自定义分辨率的总像素数必须在 655,360 到 8,294,400 之间。
* `gpt-image-2` 模型不支持透明背景。
* `gpt-image-1` 和 `gpt-image-1.5` 模型仅支持 `auto`、`1024x1024`、`1024x1536` 和 `1536x1024` 这些尺寸。其他尺寸仅受 `gpt-image-2` 模型支持。

## 输出

| 输出名称    | 描述                                                 | 数据类型  |
| ------- | -------------------------------------------------- | ----- |
| `IMAGE` | 生成或编辑后的图像。多张图像会作为批次返回；如果返回的图像尺寸不同，它们会被调整为与第一张图像匹配。 | IMAGE |

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

***

**Source fingerprint (SHA-256):** `bf588bffced6e66536b4cb54655ef6ebb9cf988d9739e3c379a8ebda1486e20a`
