ComfyUI Node

GPT Image Edit

One image in, sized from its own dimensions, changed

By Marigold1122·Created 3 months ago·Updated 22 days ago· 3
GPT Image Edit
  • image
  • image
api_key
base_url
modelgpt-image-2-vip
prompt
resolutionauto
timeout_seconds600

The sibling node to GPTImage's generate is built for one specific job: "change this image." GPTImageEdit takes exactly one required IMAGE input, reads its dimensions, and hands it to the same streaming /v1/chat/completions endpoint that the generate node uses. No aspect ratio dropdown, no resolution games in the prompt - because the edit's output ratio comes straight from your input image. It's the node you grab when you want to fix a face, restyle an existing render, or nudge a composition while keeping the source's shape.

How it works

The mechanism mirrors GPTImage: the input image becomes a base64 PNG data URL in the message, the request streams ("stream": true, same Cloudflare-timeout reasoning as the generate node), and the returned image - direct URL, b64_json, or markdown reference - gets downloaded and converted to an IMAGE tensor. The one real difference is the size logic in gpt_image_edit_size_for.

Set resolution to auto and the node sends no size at all - the model just edits at whatever it decides. Set it to 1K, 2K, or 4K and the node scales the long edge of your input to the target while preserving its aspect ratio:

1K -> long edge ~1280
2K -> long edge ~2048
4K -> long edge ~3840

So a 2560x2560 input at 4K requests 3840x3840; a 3000x2000 input at 4K requests 3840x2560. Same shape, higher ceiling. The README is explicit that the node never rewrites your prompt - what you type is what gets sent, which is the right call for an edit node where the user knows what they want changed.

Inputs

api_key, base_url, and model (the same five-model dropdown: gpt-image-2-vip, gpt-image-2, nano-banana, nano-banana-2, nano-banana-pro) - then prompt, resolution (default auto), timeout_seconds (default 600, 60–3600), and the required image input. Output is a single image tensor.

Same per-model resolution caps apply as on the generate node: gpt-image-2 and nano-banana are 1K-only, and requesting 2K/4K on them errors immediately rather than burning a failed request. gpt-image-2-vip, nano-banana-2, and nano-banana-pro handle up to 4K.

Install

Part of the Chat-Image-Bridge-Node pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Marigold1122/Chat-Image-Bridge-Node.git ComfyUI-ChatImageBridge
pip install -r ComfyUI-ChatImageBridge/requirements.txt

Restart, then api -> Chat Image Bridge -> GPT Image Edit (ComfyUI Manager: search "Chat-Image-Bridge-Node"). Dependency is just requests.

Troubleshooting

  • "image is required for GPT Image Edit" - the one input this node must have, checked before anything is sent. Leave it unplugged and you get this exact message.
  • "model supports resolution X, but got Y" - the 1K-only models being asked for more. Pick 1K or switch models.
  • Nothing happened / stream error - same family of issues as the generate node: provider refused, streamed text with no image, or the relay doesn't actually stream. The error preview tells you what came back.
  • If the edit comes back at a different shape than you expected, you're likely on auto resolution - the model decided. Setting an explicit resolution pins the long edge.

For pure text-to-image with no source, use GPTImage instead; this node is deliberately edit-shaped and doesn't even expose an aspect ratio, because your input image already is one.

Categoryapi/Chat Image Bridge

Inputs (7)

NameTypeDefaultDescription
api_keySTRING
base_urlSTRING
modelCOMBOgpt-image-2-vip5 options: gpt-image-2-vip, gpt-image-2, nano-banana, nano-banana-2, nano-banana-pro
promptSTRING
resolutionCOMBOauto4 options: auto, 1K, 2K, 4K
timeout_secondsINT60060–3600
imageIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE