comfyui-resolution-selector
Pick a megapixel budget and aspect ratio; get the closest usable resolution.
<<<<<<< HEAD
ComfyUI Resolution Selector
Pick a megapixel budget and aspect ratio; get the closest usable resolution.
Node: Resolution Selector (MP + Ratio) under utils/resolution.
Install
Copy the comfyui-resolution-selector folder into ComfyUI/custom_nodes/ and restart ComfyUI (refresh the browser too, for the live preview script).
Widgets
| Widget | Type | Purpose |
|---|---|---|
| megapixels | FLOAT (0.01 steps) | Target size, e.g. 4.15 |
| aspect_width / aspect_height | INT | Ratio terms, e.g. 16 : 9 |
| multiple | INT | Each edge snaps to a multiple of this |
| use_image | toggle | Off = input image ignored entirely |
| use_image_ratio | toggle | Use the input image's ratio instead of the ratio widgets |
| latent_type | dropdown | SD/SDXL (4ch) or Flux/SD3 (16ch) empty latent |
Inputs / Outputs (all optional)
- image (in): optional image to resize.
- latent: empty latent at the generated resolution.
- width / height: generated resolution as INTs.
- image (out): input image lanczos-resized to cover the target, then center-cropped to fit exactly.
Noneif no image was provided oruse_imageis off (don't leave it connected in that case).
Behavior
- The chosen width/height minimize combined megapixel + aspect-ratio error on the
multiplegrid, never belowmultipleper edge. - The generated resolution is shown live at the bottom of the node as you change values. With
use_image_ratioon and an image connected, it shows "resolved at runtime" since image dimensions are only known then. - Latent is
size/8per side; withmultiplebelow 8 the latent rounds down, so keepmultipleat 8+ for exact latent match. =======
comfyui-resolution-selector
eb835d85f901d0900fd87c372f9cbf43f5d60dfe