GPT Image 2 — Edit
Nine reference images and a mask, one API call
- mask
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- IMAGE
This is the node that made GPT Image 2 worth putting in a workflow at all. Generate is nice, but any API image model can write "a cat" convincingly. Edit is where the closed model's lead over local shows: it takes your existing image, an instruction, and up to nine reference images in one call, and hands back an edited result that ComfyUI treats like any other IMAGE output.
If you've tried to do character consistency or product edits with open-weight models - a LoRA here, an inpainting pass there, fighting for a dozen generations until the face sticks - you know why this is attractive. GPT Image 2 composes across the reference images in a single shot. One light aside, but genuinely: for spritesheets and multi-character scenes, local models "are not even close," as one r/comfyui user put it while trying to train a Qwen-based equivalent. That gap is the whole reason to pay per call.
How it works
Under the hood it's the same pack and the same API-key plumbing as Generate, but it calls OpenAI's images.edit() instead. Each connected image_1 through image_9 input is converted to a PNG and passed along; if you connect more than one, they go to the API as a list and the model composes across them. The result comes back base64-encoded and is decoded back into a ComfyUI IMAGE tensor.
The one mechanic worth understanding before you blame the node: the optional mask input is applied to image_1 only. That's OpenAI's mask semantics, not a bug - the node converts your MASK to an RGBA PNG (alpha = 255 − mask) and ships it with the first image. So if you're masking, put the image you want edited in the first slot. Connect no images at all and you get a clean error telling you to plug in image_1.
Inputs to care about:
- image_1 … image_9 - plain IMAGE inputs.
image_1is the base; the rest are references. - prompt - the edit instruction, in plain language ("change the shirt to navy, keep the pose").
- mask - optional, applied to image_1 only, as above.
- size / quality / n / output_format - the same set as Generate; size constraints are identical, so don't pick a 4K size with a legacy 1.x model.
Note the moderation input from Generate is absent here - Edit just doesn't expose it.
Wiring it in
Typical flow: Load Image → image_1, Load Image → image_2 (reference), prompt, then the Edit node's IMAGE output into a preview or a Save Image node. If you want to mask, connect an image through a MaskEditor or MaskFromColor first. Everything downstream is standard ComfyUI, which is the whole point of an API node - the canvas never knows the generation happened on someone else's server.
Install and cost
Same install as its sibling in this pack: Manager → Install via Git URL, or
cd ComfyUI/custom_nodes
git clone https://github.com/graedance/comfyui-gpt-image-2.git
cd comfyui-gpt-image-2
pip install -r requirements.txt
then restart. Dependencies are just openai>=1.54.0 and Pillow. Set OPENAI_API_KEY as an environment variable rather than pasting it into the node - the pasted version is saved into the workflow JSON.
Every edit is a billed call, and reference images count as input tokens on top of the output image cost. Run the pack's Estimate Cost node with input_images set to however many references you're feeding - the "image in" line is real money at $8/M tokens. And remember the API-node deal: your images and prompt go to OpenAI's servers, subject to their moderation. For a vetted-but-metered alternative, Comfy's own Partner Nodes cover the same models on prepaid credits, but they need a Comfy account; this pack just needs your key.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | gpt-image-2 | 5 options: gpt-image-2, gpt-image-2-2026-04-21, gpt-image-1.5, gpt-image-1, gpt-image-1-mini |
| prompt | STRING | — | |
| size | COMBO | 1024x1024 | 10 options: auto, 1024x1024, 1024x1536, 1536x1024, 1792x1024, 1024x1792, +4 |
| quality | COMBO | high | 4 options: auto, low, medium, high |
| output_format | COMBO | png | 3 options: png, jpeg, webp |
| n | INT | 11–8 | — |
| background | COMBO | auto | 2 options: auto, opaque |
| output_compression | INT | 1000–100 | — |
| maskopt | MASK | — | |
| api_keyopt | STRING | — | |
| image_1opt | IMAGE | — | |
| image_2opt | IMAGE | — | |
| image_3opt | IMAGE | — | |
| image_4opt | IMAGE | — | |
| image_5opt | IMAGE | — | |
| image_6opt | IMAGE | — | |
| image_7opt | IMAGE | — | |
| image_8opt | IMAGE | — | |
| image_9opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |