Nodes/ComfyUI 1hewNodes/String Resolution GPT Image 2.0
ComfyUI Node

String Resolution GPT Image 2.0

The 4k Tier Isn't 4096 — Reading GPT Image 2.0's Resolution Ladder

By 1hew·Created about a year ago·Updated 16 days ago· 35
String Resolution GPT Image 2.0
  • image
  • string
◄selection1k►

Two things about OpenAI's image endpoint trip people up constantly: the tiers are sized by area, not by longest edge, and its top rung is anchored to 3840x2160 - so "4k" here doesn't mean 4096 across. This node will tell you which rung your image actually belongs on before you pay for the call.

What it is, and when you'd want it

String Resolution GPT Image 2.0 reads an image and outputs the nearest resolution label from the three the GPT Image 2.0 API node takes: 1k, 2k, 4k. One string out. No resizing, no network traffic, no key.

The reason a node like this has to exist: the GPT Image line is closed and API-only. You can't download it, you can't run it locally, and every call is metered - Partner-Node-styled credits or a vendor key, depending on your route. When each call has a price attached, "let the model decide the size" is a decision with money in it. The 1hewOffice pack's GPT Image 2.0 node exposes a resolution input, and this node's string output wires straight into it. Two packs, same author.

You'd also pair it with Image Resize GPT Image 2.0 from the same pack, which does the pixel side with the same tier names, so the image you send and the tier you ask for stay consistent.

How the matching works

Shape doesn't enter into it. The node computes width * height and compares it to each tier's target area in log space: |log(area) - log(target_area)|, smallest wins. Targets are each tier's official 1:1 size - with one quirk in the 4k row.

| Tier | 1:1 official size | Target area | Upper edge | | --- | --- | --- | --- | | 1k | 1024x1024 | 1,048,576 | ~2.10 MP | | 2k | 2048x2048 | 4,194,304 | ~5.90 MP | | 4k | 3840x2160 (1:1 is 2880x2880) | 8,294,400 | - |

The 4k target is the area of the official 3840x2160 size, which is the same area as the 4k 1:1 size of 2880x2880 - so the ladder is consistent, it's just not square-anchored the way the others are. The boundaries fall at 2,097,152 and 5,898,138 pixels. In practice:

  • 1920x1080 = 2,073,600 pixels, landing 23,552 pixels under the 2.10 MP edge → 1k, not 2k.
  • 3000x2000 = 6 MP, just past the 5.9 MP edge → 4k. A six-megapixel image is a "4k" image here. That's the tier table, not a rounding error.
  • 2048x2048 → 2k.

Batch input is matched per frame, labels joined by newlines.

Inputs and output

selection is the COMBO, default 1k. Leave image alone and the node emits whatever you picked - a string constant for text-to-image runs where there's nothing to infer.

image is the optional IMAGE input, matched frame by frame.

string is the output: a STRING for the API node's resolution input, or anything else downstream that wants text - a filename pattern, a logging node, a conditional branch.

Installing it

ComfyUI Manager → search 1hewNodes → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

requirements.txt is a full computer-vision stack - opencv-python, scikit-image, scikit-learn, psd-tools, color-matcher, ultralytics, rembg, transparent-background, onnxruntime, av, torchaudio - because this pack also does masks, detection, tiling and video IO. None of it is needed for a string selector, but there's one install. Node registration goes through the newer comfy_api.latest schema API; on an old ComfyUI the pack won't load, and a failed dependency import gets logged and skipped, which shows up as a node silently absent from the menu.

Where people get burned

The label isn't a resize. Pair it with Image Resize GPT Image 2.0 if the pixels need to move; the API node combines this label with the ratio to decide output size.

Higher tier, higher cost. Nobody enjoys paying a 4k price for a 2 MP source, and this ladder is area-based, so the tier your image lands on is often lower than its width suggests.

Batch input makes multi-line strings. One value per image, so keep it to one image when it feeds a single field.

Also remember whose API this is. A closed model carries its provider's filter and its provider's logging; the node in your graph doesn't change either. If a prompt would be refused at the source, no amount of local plumbing fixes it.

Old workflows, missing node. v3.28.0 replaced the pack's generic resolution selector with per-model nodes. If a workflow opens with a red missing node, swap this one in.

Category1hewNodes/text

Inputs (2)

NameTypeDefaultDescription
selectionCOMBO1k3 options: 1k, 2k, 4k
imageoptIMAGE—

Outputs (1)

NameTypeDescription
stringSTRING—