2🐕Image scaling lock
Resize an image with an aspect-ratio lock, and get width/height back out
- image
- image
- width
- height
ComfyUI's core resize node makes you compute width and height yourself if you want to preserve an image's proportions, and it doesn't hand the final dimensions back out for downstream nodes to use. EG_TX_SFBLS ("Image scaling lock") fixes both: a resize node with an actual aspect-ratio-lock toggle, plus INT outputs for the resulting width and height so you can wire them straight into an Empty Latent Image or a size-matching node further down the graph.
How it works
You set target width and height, pick a crop mode, and the node resizes the image. With lock_aspect_ratio off (the default), it resizes to exactly the width and height you typed - potentially distorting the image if those don't match its native proportions. Turn lock_aspect_ratio on and, per the way this kind of lock typically behaves, only one of the two numbers ends up actually driving the resize - the other gets recalculated to preserve the source image's original proportions, so you stop fighting the two fields against each other. crop (disabled / center) decides what happens to any leftover area once the aspect ratio doesn't divide evenly: disabled just resizes, center crops from the middle to hit an exact target size.
The inputs and outputs that matter
image(IMAGE, required).width/height(INT, required, default 512, range 0–10000) - target dimensions.crop(enum:disabled/center, required) - how to handle a size that doesn't cleanly match the target aspect ratio.upscale_method(enum: nearest-exact / bilinear / area / bicubic / lanczos, optional) - resampling algorithm;lanczosis the standard choice for upscaling quality,areafor downscaling.lock_aspect_ratio(BOOLEAN, defaultfalse, optional) - the node's namesake feature.
Three outputs: image (the resized result), plus width and height (INT) reporting the actual final dimensions - genuinely useful when lock_aspect_ratio means the output size isn't exactly what you typed, since you can feed those two numbers into whatever else in your graph needs to match.
How to install it
ComfyUI Manager: search Comfyui-ergouzi-Nodes. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/11dogzi/Comfyui-ergouzi-Nodes.git
Restart. The author's README flags this English repo as frozen, with newer development happening on a Chinese-named sibling pack - worth knowing if you're building around this node long-term.
Common issues & troubleshooting
Output image is stretched or squashed. That means lock_aspect_ratio is off and your width/height don't match the source's proportions - either turn the lock on, or compute matching dimensions yourself before this node if you specifically want a non-proportional resize.
Final size doesn't match what you typed. That's expected behavior once lock_aspect_ratio is on - one of the two fields you set gets overridden to preserve proportions. Read the width/height outputs rather than assuming the input values are what actually shipped downstream.
Upscaled image looks soft or blocky. Check upscale_method - nearest-exact is fast but blocky on upscales, while lanczos or bicubic give smoother results at some extra compute cost. area is generally the better pick specifically when you're downscaling, not upscaling.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 5120–10000 | — |
| height | INT | 5120–10000 | — |
| crop | COMBO | 2 options: disabled, center | |
| upscale_methodopt | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, lanczos | |
| lock_aspect_ratioopt | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |