π Resolution Image Size Selector
Resolutions That Match the Model, Not Yesterday's Guess
- image (optional)
- width
- height
- latent
Every model has sizes it was trained on, and generating outside them is how you get duplicated anatomy, stretched limbs and tiling. SDXL's comfortable set is 1024Γ1024 and the discrete ratios around it (1152Γ896, 1216Γ832, 832Γ1216); SD 1.5 falls apart above ~768; Flux is flexible but wants multiples of 64. π Resolution Image Size Selector packages those numbers as presets, and outputs a ready-made latent so you can skip the Empty Latent node entirely.
Two things make it more than a dropdown. First, it has a preset_user slot you can edit yourself, so your own favourite sizes live next to the built-in ones. Second, it can take an image input and derive resolution from it - which is the killer feature for img2img, upscales and ControlNet workflows where you want the output to match whatever came in.
How it works
Selection priority is fixed and documented: input image β user preset β standard preset β custom width/height (used only when the preset is Custom).
Standard presets are grouped per family - SDXL, Flux, Flux2, Z-Image, Qwen, WAN Video, Hunyuan Video and more - with each entry named by shape and ratio ([Vertical Photo] 832x1216 2:3). That's why preset is a long combo box rather than a number.
User presets live in ComfyUI/custom_nodes/ComfyUI-mnemic-nodes/nodes/resolution_selector/user_resolution.json, which is created on first launch with a Favorites category (768Γ768, 540Γ960, 1080Γ1920, 832Γ1216 and so on). Edit the JSON, restart, and they show up in preset_user. Setting it to None hands control back to the standard preset.
When an image is connected, the node takes its dimensions and then bends them to your constraints: image_min_length guarantees the short side is at least N, image_max_length caps the long side at N. snap_to_nearest plus snap_resolution rounds the result to a multiple - 8 or 64 are the useful values. multiply scales the final numbers, and negative values flip the dimensions. swap_width_and_height swaps them outright. The latent output is a batch of empty latents at width/8 Γ height/8, one per batch_size.
Inputs and outputs
Required: preset, preset_user, custom_width, custom_height, multiply, swap_width_and_height. Optional: image, image_min_length, image_max_length, snap_to_nearest, snap_resolution, batch_size.
Outputs: width, height, and latent. The width/height ints are the interesting ones for plumbing - feed them to a ControlNet preprocessor, an upscale factor calculation, or a filename. The latent goes straight into a KSampler, which is one fewer node in the graph than the usual Empty Latent setup.
Install
ComfyUI Manager β "ComfyUI-mnemic-nodes" β restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MNeMoNiCuZ/ComfyUI-mnemic-nodes
No model downloads. The pack installs its full requirements.txt (transformers, opencv-python, tiktoken, piexifβ¦) for its other nodes.
Common issues
Size drifts off a multiple of 8. Snapping is off by default, and image_min_length can nudge dimensions to odd values. Turn on snap_to_nearest and set snap_resolution to 8 (safe) or 64 (Flux-friendly).
A preset seems to be ignored. Something higher in the priority chain is winning. If an image is connected, it beats every preset in the dropdown.
custom_width/custom_height do nothing. They only apply with preset set to Custom.
The user preset list is stale. It's read from JSON at node-schema build time - edit the file, then restart ComfyUI.
Anything odd and it falls back to 512Γ512 with a 64Γ64 latent, printing a traceback to the console. If your output silently shrank, read the console.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| preset | COMBO | Custom | Select a model-specific resolution preset or use custom dimensions |
| preset_user | COMBO | None | User-defined preset selection (overrides main preset when selected) |
| custom_width | INT | 51264β16384 | Custom width (Only used with Custom preset) |
| custom_height | INT | 51264β16384 | Custom height (Only used with Custom preset) |
| multiply | FLOAT | 1.00 | Multiplier for the final resolution. Negative values will flip the dimensions. |
| swap_width_and_height | BOOLEAN | false | Swap width and height dimensions |
| image (optional)opt | IMAGE | Priority order for resolution selection: 1. Input Image 2. User Preset 3. Preset 4. Custom Values (when preset is set to 'Custom') | |
| image_min_lengthopt | INT | 00β16384 | When image is provided, ensures the shortest side is at least this length (0 = ignore) |
| image_max_lengthopt | INT | 00β16384 | When image is provided, ensures the longest side is at most this length (0 = ignore) |
| snap_to_nearestopt | BOOLEAN | false | When enabled, dimensions will be adjusted to the nearest multiple of snap_resolution |
| snap_resolutionopt | INT | 00β16384 | Snap dimensions to multiples of this value (0 = no snapping) |
| batch_sizeopt | INT | 11β64 | Number of latent images to generate in batch |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | The final scaled width in pixels. |
| height | INT | The final scaled height in pixels. |
| latent | LATENT | The final scaled latent. |