Nodes/ComfyUI 1hewNodes/String Resolution Gemini 3.1 Flash Image
ComfyUI Node

String Resolution Gemini 3.1 Flash Image

Gemini 3.1 Flash's Ladder Has a 512px Rung — Picking the Right Tier

By 1hew·Created about a year ago·Updated 17 days ago· 35
String Resolution Gemini 3.1 Flash Image
  • image
  • string
◄selection1k►

Four rungs, and the bottom one is 0.5k - 512x512, a size most people assumed stopped being relevant around 2023. It's there because this is an API model billed per call, and a cheap draft tier is a feature.

What it is, and when you'd want it

String Resolution Gemini 3.1 Flash Image takes an image and outputs the nearest of four resolution labels the Gemini 3.1 Flash image endpoint accepts: 0.5k, 1k, 2k, 4k. One string out, no resizing, no request, no key.

Context worth having: Gemini 3.1 Flash is Google's speed-and-quality hybrid image model - the one the KB tracks as the successor to Nano Banana Pro in that line, closed weights, aggressive moderation, and only reachable through the API. A node pack can't run it locally, so you call it, and the call carries a resolution tier. The 1hewOffice pack wraps that endpoint with a Gemini 3.1 Flash Image node whose resolution input wants one of these four strings; this node produces it. Two packs by the same author, one string of glue between them.

You'd reach for it when a reference image is driving the job - an image-to-image pass, a style transfer, a restyle where you want output size to follow the input rather than a hardcoded number. And the 0.5k tier is genuinely useful: for iterating on a prompt before committing to a 4k call, dropping a tier is the cheapest knob you have on a metered node.

How the matching works

It ignores shape entirely and matches on total pixel area, in log space: |log(w*h) - log(target_area)|, smallest difference wins. Targets are each tier's official 1:1 size.

| Tier | 1:1 official size | Target area | Upper edge (geometric midpoint) | | --- | --- | --- | --- | | 0.5k | 512x512 | 262,144 | ~0.52 MP | | 1k | 1024x1024 | 1,048,576 | ~2.10 MP | | 2k | 2048x2048 | 4,194,304 | ~8.39 MP | | 4k | 4096x4096 | 16,777,216 | - |

Because the tiers are powers of two in area, those edges are exact: 524,288 / 2,097,152 / 8,388,608 pixels. Which produces two results people don't expect:

  • 1920x1080 is 2.07 MP, which is just under the 2.10 MP edge → 1k, not 2k.
  • 3840x2160 - the image file you might label "4K" - is 8.29 MP, sixty thousand pixels shy of the 4k edge → 2k. Not a bug. It's area, and it's log-area.

Batch inputs are matched per frame and joined with newlines, one label per image.

Inputs and output

selection is the COMBO, default 1k. With image left unconnected, the node just forwards your choice - a string constant, which is all you need for text-to-image.

image is the optional IMAGE input and the reason to use the node at all: connect it and the nearest tier comes out per frame.

string is the STRING output for the API node's resolution input, or any other text consumer.

Installing it

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

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

The pack's requirements.txt is a full CV toolkit - opencv-python, scikit-image, scikit-learn, psd-tools, color-matcher, ultralytics, rembg, transparent-background, onnxruntime, av, torchaudio - for a pack that also does masks, video IO, tiling and background removal. A resolution selector needs none of it, but installs ship together. Registration uses the newer comfy_api.latest schema API, so a very old ComfyUI won't load the pack; and the loader logs-and-skips modules whose imports fail, which means a missing dependency surfaces as a node that isn't in the menu rather than an error box.

Where people get burned

A label is not a resize. If you want the pixels to actually change, that's Image Resize Gemini 3.1 Flash Image in the same pack - it carries the tier presets and an auto mode, plus synchronized mask transforms.

Tier is money. On metered API nodes, 4k costs more than 1k for the same prompt. Match the tier to the job: 0.5k to find the composition, 2k to judge it, 4k for the one you keep.

Batches make multiline output. One line per image. A resolution field wants one value.

Old workflows may lose the node. v3.28.0 swapped the generic String Resolution node for per-model selectors like this one. A missing-node error after an upgrade is that change, not corruption.

Category1hewNodes/text

Inputs (2)

NameTypeDefaultDescription
selectionCOMBO1k4 options: 0.5k, 1k, 2k, 4k
imageoptIMAGE—

Outputs (1)

NameTypeDescription
stringSTRING—