Nodes/ComfyUI 1hewNodes/String Resolution
ComfyUI Node

String Resolution

Which resolution tier is your image, really? 0.5k, 1k, 2k, or 4k

By 1hew·Created about a year ago·Updated 7 days ago· 33
String Resolution
  • image
  • string
selection1k

Models talk in resolution tiers - "this one wants 1k," "that one caps at 2k" - but real images come in arbitrary pixel sizes. String Resolution is the translator: it looks at an image, decides which of the four standard tiers (0.5k, 1k, 2k, 4k) it belongs in, and outputs that label as a string. No resizing happens, no API is called. It's pure classification, and the string it produces is exactly what you feed to a resize node or an API adapter that takes tier names.

How it works

The node holds four tiers, each defined by a target area: 512×512 for 0.5k, 1024×1024 for 1k, 2048×2048 for 2k, 4096×4096 for 4k. For each frame of the connected image, it computes the pixel area and finds the tier whose area is closest - again using log-space distance, so a 700×700 image (area ~490k) and a 1400×700 image (same area, different shape) both classify the same way. That's the right behavior: tier is about how many pixels you're working with, not the aspect ratio.

One label per frame is emitted. With no image connected, it passes through the selection value unchanged - so it doubles as a manual tier picker, same dual-mode design as the ratio nodes in this pack.

The inputs that matter

  • selection (COMBO, default 1k) - manual tier label, used when no image is connected.
  • image (IMAGE, optional) - auto-classify mode.

One output: string (STRING) - the tier label(s).

Installing it

ComfyUI Manager → search ComfyUI-1hewNodes → install → restart, or:

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

Restart ComfyUI. No models, no downloads, no keys - area math against four constants. The pack installs heavyweight requirements regardless, and it targets ComfyUI's newer comfy_api.latest API; update ComfyUI if the nodes don't appear.

Common issues

The big conceptual trap: this classifies by area, so a tall 900×2400 image (area 2.16M) classifies as 2k even though no single dimension is near 2048. If your downstream expects a tier to mean "longest side," you'll disagree with this node's output. Relatedly, it's a nearest-match, not a guarantee - an 800×800 image is "1k-ish" but isn't 1024. And the batch rule from the ratio nodes applies: multiple frames in, multiple lines out. If you're using the output as a size selector for a resize node, remember it only names the tier; you still need the actual resize step.

Category1hewNodes/text

Inputs (2)

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

Outputs (1)

NameTypeDescription
stringSTRING