Smart Aspect Scaler
The node that decides what resolution your image should be
- image
- sdxl_image
- wan_image
- original_width
- original_height
- scaled_sdxl_size
- scaled_wan_size
Smart Aspect Scaler is the flagship node of the ComfyUI Smart Scaler pack, and it exists to kill the most tedious step in a Wan 2.1 or SDXL workflow: figuring out what size to make your image. You drop in a frame that's, say, 1000x2000, pick "Both" and a Wan size, and it hands you back a correctly-scaled image and the exact dimensions as a string. No more dividing by 64 in your head, no more guessing whether 1543x2187 will blow up the VAE.
Why this matters. Wan's VAE and SDXL both perform best at specific resolution buckets near their training sizes. Wan 2.1's official buckets are 480p (854x480) and 720p (1280x720), and the community also uses the SDXL-family portrait/landscape/square sizes - 512x768, 768x1152, 1024x1536 - that this node's Small/Medium/Large presets map to. If your input aspect ratio doesn't match a bucket, you either stretch it (bad), crop it (lose content), or pad it (black bars). This node does the choosing for you, and it always lands on dimensions compatible with the pipeline.
How it works
The mechanism is simple and worth understanding because it explains the gotchas. The node reads the aspect ratio of the first frame of your input, then picks the closest of three orientation variants - portrait, landscape, square - within the target resolution family. It scales the image to fill that target (the code comments literally call it "fill, not fit"), then, if you leave force_multiple_64 on (default), rounds the intermediate size down to a multiple of 64 and resizes with LANCZOS.
That's where the three fit_strategy options diverge:
resize(default) keeps the aspect-ratio-preserving, multiple-of-64 size. This means the output is not always exactly the advertised bucket - a portrait image sent to Wan Medium comes back as 768x1536 rather than 768x1152, because that's the closest fit at the right aspect. That's usually fine, because it's still a sensible size, but it surprises people.padgives you the exact target with black bars on the short sides.cropgives you the exact target by center-cropping away the overflow.
Inputs and outputs that matter
You really only touch three things: target_models (SDXL, Wan, or Both - Both is the default and gives you two outputs at once), wan_size (Small/Medium/Large, which only matters when Wan is involved), and fit_strategy (see above). Leave force_multiple_64 on.
Outputs: sdxl_image and wan_image are the scaled images; original_width/original_height are the source dimensions as integers; scaled_sdxl_size and scaled_wan_size are strings like "1024x1536". That string output is the real prize - wire it into Size Parser to get integers for EmptyLatentImage or the Wan sampler's width/height fields. One trap: if you pick target_models: SDXL, wan_image is a black 512x512 placeholder and scaled_wan_size is "N/A". Don't feed that string into anything expecting a real size.
Installation
ComfyUI Manager, search comfyui-smart-scaler, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/babydjac/comfyui-smart-scaler.git
pip install torch Pillow numpy
Dependencies are just torch, Pillow and numpy - nothing heavy, no model downloads, no PyAV. The node appears under SmartScaler in the node menu (the video nodes are under SmartScaler/Video). If ComfyUI Manager warns about a node-name conflict with another pack on install (the pack shares the ImageMetadataExtractor name with another project), that's the standard "two packs define the same node name" warning - safe to proceed unless you actually have both installed.
Common issues
The biggest beginner complaint is "why didn't it give me 768x1152 when I asked for Medium?" - that's the resize behavior above. If you need the exact bucket, switch to pad or crop. Also remember this node only processes the first frame of a batch. For a video's worth of frames, use Batch Frame Processor from the same pack, which applies one consistent scale to every frame.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_models | COMBO | Both | 3 options: SDXL, Wan, Both |
| wan_size | COMBO | Small | 3 options: Small, Medium, Large |
| fit_strategy | COMBO | resize | 3 options: resize, pad, crop |
| force_multiple_64opt | BOOLEAN | true | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| sdxl_image | IMAGE | — |
| wan_image | IMAGE | — |
| original_width | INT | — |
| original_height | INT | — |
| scaled_sdxl_size | STRING | — |
| scaled_wan_size | STRING | — |