Nodes/ComfyUI 1hewNodes/Image Resize GPT Image 2.0
ComfyUI Node

Image Resize GPT Image 2.0

A resize node that speaks GPT Image 2.0's dimension language — no API, no key

By 1hew·Created about a year ago·Updated 7 days ago· 33
Image Resize GPT Image 2.0
  • image
  • mask
  • image
  • mask
preset_sizeauto (2k)
fitcrop
pad_color1.0

Let's get the misleading part out of the way first: the name says GPT Image 2.0, but this node calls no OpenAI API and needs no key. It's a local size adapter. It takes whatever image and mask you feed it and reshapes them to the exact resolutions OpenAI's GPT Image 2.0 model is designed around, so your image is already in the right bucket when it hits a pipeline that cares about that.

Why is that a thing worth a node? Because "just resize to 1024" is not how these models want to be fed. GPT Image 2.0 has a fixed set of supported aspect ratios, and each one has a real 1k, 2k, and 4k variant - 1728x576 (3:1), 1024x1024 (1:1), 576x1728 (1:3), and about forty others. If you're prepping inputs for a gpt-image workflow, or you just like those proportions for your own generation and want your control image to match exactly, hand-picking them from memory is a recipe for typos. This node carries the whole table.

How it works

The node ships a list of ~45 preset resolutions grouped into [1k], [2k], and [4k] tiers. Your preset_size dropdown controls which one you land on:

  • auto / auto (1k) / auto (2k) / auto (4k) - picks the preset whose aspect ratio is closest to your source (it compares log-aspect-ratios), then breaks ties by area. auto (2k) is the default and is usually the right call.
  • dynamic / dynamic (1k) / dynamic (2k) / dynamic (4k) - ignores the preset table and computes a fresh size from a target pixel count (1024², 2048², or 3840x2160), clamping the aspect ratio to between 1:3 and 3:1 and rounding to a multiple of 16.
  • any named preset - exactly that resolution, no thinking.

Then fit decides how to get there: crop (center-crops to the target ratio - the default), pad (fits the whole image inside and fills the bars with pad_color), or stretch (distorts). pad_color defaults to 1.0, i.e. white, and accepts the usual formats the 1hewNodes color parser knows - 255,0,0, #ff0000, named colors.

The image resizes with bicubic interpolation; the mask resizes in lockstep with nearest-neighbor, which keeps a binary mask from turning into a smeared gray gradient. That synchronized image+mask output is the reason to pick this over a bare Resize node - both come out the far end at the same target size, ready to feed a ControlNet or an inpaint pass.

The inputs that matter

You set preset_size and fit, maybe pad_color if you're padding. Wire in image and, if you have one, mask. Outputs are image and mask, both at the target resolution.

Installing it

This is part of the 1hewNodes pack, so there's no separate repo. Easiest path: install ComfyUI Manager, search for "ComfyUI 1hewNodes", hit Install, restart. Or clone it by hand:

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

Then restart ComfyUI. This node needs nothing special - the pack's requirements install a pile of libraries, but numpy, Pillow, and torch are all this resize family touches. No model downloads.

Common issues

The one trap is expecting auto to mean "whatever, just fit my image." It means "nearest supported GPT preset," which is deterministic and usually what you want, but if you're feeding oddball ultrawide crops, dynamic is the mode that respects your actual aspect ratio instead of snapping to a preset. And if the output looks slightly soft, that's bicubic doing its job - downscaling to a preset is information loss by design. Pair it with the pack's Int Image Size nodes if you ever want to see what dimensions you're actually landing on before you commit.

Category1hewNodes/image/resize

Inputs (5)

NameTypeDefaultDescription
preset_sizeCOMBOauto (2k)53 options: auto, auto (1k), auto (2k), auto (4k), dynamic, dynamic (1k), +47
fitCOMBOcrop3 options: crop, pad, stretch
pad_colorSTRING1.0
imageoptIMAGE
maskoptMASK

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK