π Text To Resolution
Type '1024x1024' and get two proper integers out
- WIDTH
- HEIGHT
The most tedious part of ComfyUI is still typing the same resolution into every EmptyLatentImage you touch. π
Text To Resolution is a small quality-of-life hack for that: you type 1024x1024 into a text box and it hands back two typed integers, WIDTH and HEIGHT, ready to feed directly into an empty latent or an image-resize node. It converts one human-readable string into the two numbers the rest of the graph actually wants, which is a better deal than it sounds.
How it works
The text input is a STRING with a default of 512x512. On execution the node takes the text, splits off anything after the first space, then splits on the lowercase x, and converts both halves to integers. So 1024x1024 β 1024 and 1024, and 1536x1024 β 1536 and 1024. Two outputs, WIDTH (INT) and HEIGHT (INT), come out the right side, and you wire them into the corresponding ports.
The parsing is deliberately dumb, which is the useful part and the limitation at once. It expects the format WIDTHxHEIGHT - no spaces around the x, nothing else in the string before it. 1024 x 1024 (with spaces) will trip it up, and text after a space is ignored. Keep your input clean and it never complains.
Where it shines
Wire WIDTH/HEIGHT into an EmptyLatentImage, and you've got a resolution box in the graph you can read at a glance - far easier to audit than a set of disconnected integer nodes. Because the inputs are strings, it also composes with text generation: have an LLM node (like the pack's π
OpenAI GPT Chat) output "1024x1024" and this node turns that into real dimensions the graph can act on. That single trick - text from an AI model becoming actual parameters - is a genuinely nice pattern.
Inputs and outputs
- text -
STRING, default"512x512", formatWIDTHxHEIGHT. - Outputs: WIDTH (
INT), HEIGHT (INT).
Install
Part of hay86/ComfyUI_AceNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/hay86/ComfyUI_AceNodes
cd ComfyUI_AceNodes
pip install -r requirements.txt
Restart ComfyUI and look for π
Text To Resolution under Ace Nodes. Manager users search ComfyUI_AceNodes.
The caveats
Keep the input strictly WIDTHxHEIGHT - lowercase x, no spaces - or you'll get a cryptic parse error that doesn't tell you what you did wrong. And expect the pack's usual install weight: the full requirements.txt (rembg, transformers, boto3β¦) installs regardless of whether you use this node. For turning a readable resolution string into workflow parameters, it's a small but real quality-of-life win.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | 512x512 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| WIDTH | INT | β |
| HEIGHT | INT | β |