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

# OpenAIGPTImageNodeV2 - ComfyUI Built-in Node Documentation

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

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/OpenAIGPTImageNodeV2/en.md)

## Overview

This node generates images using OpenAI's GPT Image API. It supports multiple models, allows you to provide input images for editing, and can use a mask to specify which parts of an image to modify.

## Inputs

| Parameter             | Data Type | Required | Range                                                                                                                                                                            | Description                                                                                                         |
| --------------------- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `prompt`              | STRING    | Yes      | N/A                                                                                                                                                                              | Text prompt for GPT Image (default: "").                                                                            |
| `model`               | COMBO     | Yes      | `"gpt-image-2"`<br />`"gpt-image-1.5"`<br />`"gpt-image-1"`                                                                                                                      | The OpenAI GPT Image model to use. Selecting a model reveals additional parameters specific to that model.          |
| `model.size`          | COMBO     | Yes      | `"auto"`<br />`"1024x1024"`<br />`"1024x1536"`<br />`"1536x1024"`<br />`"2048x2048"`<br />`"2048x1152"`<br />`"1152x2048"`<br />`"3840x2160"`<br />`"2160x3840"`<br />`"Custom"` | Image size. Select 'Custom' to use the custom width and height (default: "auto"). Only available for `gpt-image-2`. |
| `model.custom_width`  | INT       | No       | 1024 to 3840                                                                                                                                                                     | Used only when `size` is 'Custom'. Must be a multiple of 16 (default: 1024). Only available for `gpt-image-2`.      |
| `model.custom_height` | INT       | No       | 1024 to 3840                                                                                                                                                                     | Used only when `size` is 'Custom'. Must be a multiple of 16 (default: 1024). Only available for `gpt-image-2`.      |
| `model.background`    | COMBO     | Yes      | `"auto"`<br />`"opaque"`                                                                                                                                                         | Return image with or without background (default: "auto"). Only available for `gpt-image-2`.                        |
| `model.quality`       | COMBO     | Yes      | `"standard"`<br />`"hd"`                                                                                                                                                         | The quality of the generated image. Only available for `gpt-image-2`.                                               |
| `model.images`        | IMAGE     | No       | N/A                                                                                                                                                                              | Input images for editing. Only available for `gpt-image-2`.                                                         |
| `model.mask`          | MASK      | No       | N/A                                                                                                                                                                              | A mask to specify which parts of the input image to edit. Only available for `gpt-image-2`.                         |
| `n`                   | INT       | Yes      | 1 to 8                                                                                                                                                                           | How many images to generate (default: 1).                                                                           |
| `seed`                | INT       | Yes      | 0 to 2147483647                                                                                                                                                                  | Seed for reproducibility (default: 0). Note: not implemented yet in backend.                                        |

**Parameter Constraints and Limitations:**

* When using `gpt-image-2` with a `model.size` of "Custom", the `custom_width` and `custom_height` must be multiples of 16, the maximum edge must be less than or equal to 3840, the aspect ratio must not exceed 3:1, and the total pixel count must be between 655,360 and 8,294,400.
* If a `mask` is provided, an input image (`model.images`) is required. A mask cannot be used without an input image.
* A mask cannot be used with multiple input images.
* When a mask is provided, the mask dimensions must match the input image dimensions.
* The `seed` parameter is currently not functional.

## Outputs

| Output Name | Data Type | Description                    |
| ----------- | --------- | ------------------------------ |
| `image`     | IMAGE     | The generated image or images. |

***

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