Nodes/gpt-image-2-comfyui/๐Ÿ–ผ๏ธ GPT-Image-2 Image to Image
ComfyUI Node

๐Ÿ–ผ๏ธ GPT-Image-2 Image to Image

Editing up to 9 reference images

By Anil-matchaยทCreated about a month agoยทUpdated about a month agoยท 1
๐Ÿ–ผ๏ธ GPT-Image-2 Image to Image
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image
  • image_url
  • request_id
โ—„promptTransform this product image into a premium e-commerce poster style.โ–บ
โ—„seed0โ–บ
โ—„api_keyโ–บ

Text-to-image is the boring half of this pack. The reason GPT-Image-2 is worth paying for is native image editing, and that's exactly what the ๐Ÿ–ผ๏ธ GPT-Image-2 Image to Image node exposes: you feed it up to nine reference images plus a prompt describing what to change, and it hands back a new image. No inpaint masks, no ControlNet, no regional prompters to coax it along. You describe the edit in plain English and the model just... does it.

That's a bigger deal than it sounds if you've spent time wrangling local img2img. Style transfer, product-shot reimagining, character consistency across references, "swap this background but keep the subject" - all of it collapses into one node and one prompt. The community has leaned on exactly this for storyboarding: generate a 16-cell plan with GPT-Image-2, then feed the frames to a video model. One node, nine references, zero fiddling.

How it works

The mechanism is the same remote-call pattern as the text-to-image node, with one extra step up front. Each IMAGE tensor you wire in gets squashed to its first frame, converted to a JPEG at quality 95, and POSTed to muapi's /upload_file endpoint with your key. The returned URLs go into the request payload as images_list, the whole thing gets POSTed to /api/v1/gpt-image-2-image-to-image, and the node polls every 5 seconds for up to 10 minutes until the result lands. Then it downloads the image and hands you a normal IMAGE tensor.

Two details from the source are worth knowing. First, only the first frame of any batch is used - wire a single image per input slot, not a batch. Second, the uploads happen before the generation, so more reference images means a longer preflight and a bigger bill. Nine references is a real feature, not a rounding error; use the ones that matter.

Inputs and outputs

The three inputs you actually set:

  • prompt (multiline STRING) - describes the transformation. The default, "Transform this product image into a premium e-commerce poster style," is a decent template: name the subject's role, then the target style.
  • seed (INT) - not sent to the API. GPT-Image-2 has no seed control, so this exists purely to force ComfyUI to re-run the node instead of serving a cached result. It's your re-roll button.
  • image_1 through image_9 (IMAGE, all optional) - the references. Wire LoadImage outputs in, or even chain another generation node's image output here. At least one is required; the pack raises ValueError: At least one input image is required. if you queue it empty.
  • api_key (optional STRING) - wire from the ๐Ÿ”‘ API Key node or leave blank to use the CLI config.

The outputs are identical to the text-to-image node: image (IMAGE, into PreviewImage/SaveImage), image_url (STRING, the CDN link), and request_id (STRING, for dashboard debugging).

Install and gotchas

Same install as the rest of the pack - ComfyUI Manager or:

cd ComfyUI/custom_nodes
git clone https://github.com/Anil-matcha/gpt-image-2-comfyui
pip install -r gpt-image-2-comfyui/requirements.txt

Dependencies are just requests, Pillow, numpy, and torch - all already present. No weights, no model download, no GPU requirement.

The failure modes are the ones you'd expect from a paid remote service. 401 is a bad key, 402 is out of credits, 429 is rate-limiting. Two less obvious ones: the JPEG q95 upload is lossy, so if you're editing fine detail the compression is doing some of the work before the model ever sees the image - start from a reasonably large source. And if your reference is a batch, remember only frame one survives, which is a silent surprise until you look at the output and wonder where your other frames went. None of it is fatal; this node is genuinely the one you'd reach for when you want GPT-Image-2's editing chops without leaving ComfyUI.

Category๐Ÿ–ผ๏ธ GPT-Image-2

Inputs (12)

NameTypeDefaultDescription
promptSTRINGTransform this product image into a premium e-commerce poster style.โ€”
seedINT00โ€“18446744073709550000Not sent to the API โ€” GPT-Image-2 has no seed control. Changing this forces ComfyUI to re-run the node instead of reusing a cached result on repeat/batch generations.
api_keyoptSTRINGโ€”
image_1optIMAGEโ€”
image_2optIMAGEโ€”
image_3optIMAGEโ€”
image_4optIMAGEโ€”
image_5optIMAGEโ€”
image_6optIMAGEโ€”
image_7optIMAGEโ€”
image_8optIMAGEโ€”
image_9optIMAGEโ€”

Outputs (3)

NameTypeDescription
imageIMAGEโ€”
image_urlSTRINGโ€”
request_idSTRINGโ€”