TS Resolution Selector
The 'always a valid canvas size' node you'll stick in every workflow
- image
- img
Every sampler in the ecosystem wants its latent at dimensions that play nice with the model - multiples of 8 for a plain VAE, multiples of 16 or 32 for the transformer-based families, and the aspect ratio you actually want. Punching "1280x720" into an Empty Latent Image is fine until you realize it's not a multiple of 32 and the VAE silently pads and rescales on the way back, costing you a blurry frame. TS Resolution Selector is the node that removes the arithmetic: pick an aspect ratio and a megapixel budget, and it hands you a canvas that's always a valid size.
How it works
Three values in, one image out. aspect_ratio is a preset (1:1, 4:3, 3:2, 16:9, 21:9, and the portrait mirrors), resolution is a target in megapixels (0.5–4), and custom_ratio takes a literal "W:H" that overrides the preset unless it's left at "0:0". The node derives width and height from those two and snaps the result to multiples of 32. That's the whole mechanism, and it's the right kind of boring.
The genuinely useful toggle is original_aspect. Connect an image and flip it on, and the ratio comes from that image instead of the preset - so you can normalize an arbitrary input into the latent grid without caring what shape it arrived in.
There's also a hidden-in-plain-sight trick: the optional image input. Connect a picture and the node doesn't just return a blank canvas - it fits your image onto the computed canvas (letterboxed, i.e. scaled to fit without distortion). That's handy when you want to start a generation from an existing picture but at a fixed, model-friendly resolution.
The single img output goes straight into whatever wants a canvas: run it through VAE Encode when a sampler needs a latent, or use it wherever a workflow expects a fixed-size image. In practice, the README's own advice is the best summary: use it as your latent-image source, because it always returns a sampler-friendly size.
Install
No extra dependencies - it's a pure-Python utility inside comfyui-timesaver.
cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-timesaver
cd comfyui-timesaver
python -m pip install -r requirements.txt
Restart ComfyUI, then right-click → Add Node and search "TS Resolution Selector".
Common issues
- "My image came out stretched." You connected an image without
original_aspect, and the preset ratio won against the image's own shape. Flip the toggle, or setcustom_ratioto match. - "It snapped to a size I didn't ask for." That's the multiples-of-32 rule doing its job - a 16:9 at 1.5 MP doesn't land exactly on a 32-grid, and the node rounds to stay valid. The output is always at most a hair off your budget, which is the price of never feeding a bad size downstream.
- "Where's my blank canvas?" The
imgoutput is the canvas - a plain IMAGE at the computed resolution. If you need a latent, run it through VAE Encode (withoriginal_aspecthandling any source).
The one honest limitation: it's a canvas, not a composition tool. It won't crop your subject or leave you room for a face swap region - it just answers "what's a valid size at this aspect?" every single time, which is the job most people wired three nodes together to do before.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | COMBO | 1:1 | Aspect-ratio preset for the output resolution. |
| resolution | FLOAT | 1.50.1–3 | Target size in megapixels; width and height are derived from it and the aspect ratio. |
| custom_ratio | STRING | 0:0 | Custom aspect ratio as 'W:H'. Overrides the preset unless left at '0:0'. |
| original_aspect | BOOLEAN | false | Use the connected image's aspect ratio instead of the preset. |
| imageopt | IMAGE | Optional image fitted onto the computed canvas (letterboxed). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| img | IMAGE | Blank or image-filled canvas at the computed resolution. |