Image_Resize(mki-图像大小调整)
A resize node that doubles as a resolution calculator
- image
- image
- width
- height
ComfyUI's built-in resize node does one job: fit an image to a target size. Image_Resize_makki (display name "Image_Resize(mki-图像大小调整)") is the version you reach for when "target size" is a constraint rather than a rectangle - you want to fit a long image into a square-pixel budget, match a short side, or snap dimensions to a multiple of 8/64/512. And because it also spits out the computed width and height as integers, you can use it purely as a resolution calculator feeding other nodes.
How it works
It figures out what "resize" means from which optional inputs you provide:
- width + height both set → resize to exactly that rectangle.
- width only → scale height to keep aspect ratio.
- height only → scale width to keep aspect ratio.
- short_side set → fit the short edge to that value, letting the long side follow (great for "make this fit a 1024 grid without squishing").
- none of the above → fit the image into a square-pixel budget:
size(default 1024) means the target has roughlysize × sizepixels, preserving aspect.
The GCD input (Greatest Common Divisor, default 1) rounds both dimensions up to a multiple of that number. Set it to 8 or 64 to keep results VAE/sampler-friendly - this is the knob that keeps your resized latent from throwing shape errors downstream. If image is left disconnected, the node still computes the target dimensions and hands you an empty tensor - the calculator mode.
The inputs that matter
- size - the pixel-budget or reference size, default 1024, up to 8192.
- GCD - rounding constraint (1–512). This is the one beginners miss; bump it to 8/64 when the sampler complains.
- upscale_method -
auto(default) picks per direction:areawhen shrinking,lanczoswhen enlarging,nearest-exactwhen nothing changes. Or force one:nearest-exact,bilinear,area,bicubic,lanczos. - crop_method -
disabledorcenter. - Optional width, height, short_side - the constraint inputs above.
Outputs: image, plus width and height as INTs. Wiring those integers into a latent resize, a text label, or a filename makes the "calculator" bit genuinely handy.
When you'd actually use it
The auto method is the honest workhorse - Lanczos for upscaling is the classic "more pixels, no hallucination" approach that's still the right call for clean enlargements, and area is the correct downsample. Where this node stands out is the constraint math: fitting into a pixel budget or a short side is something core ComfyUI makes you compute yourself.
Installing
It's part of ComfyUI-MakkiTools:
cd ComfyUI/custom_nodes
git clone https://github.com/MakkiShizu/ComfyUI-MakkiTools
cd ComfyUI-MakkiTools
pip install -r requirements.txt
Restart, find it under MakkiTools. Watch the GCD: forgetting it is the classic way to get a resized image that then fails to encode because the latent dimensions aren't model-friendly. And if you resize before a generative upscale step, the budget mode will happily shrink a portrait into a near-square - check whether you wanted short_side instead.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| upscale_method | COMBO | auto | Method to upscale the image 图像放大方法 |
| crop_method | COMBO | center | Method to crop the image 图像裁剪方法 |
| size | INT | 10241–8192 | Target size (based on selected dimension) 目标尺寸(基于选定的维度) |
| GCD | INT | 11–512 | Greatest Common Divisor constraint 最大公约数约束 |
| imageopt | IMAGE | Input image 输入图像 | |
| widthopt | INT | 1–8192 | Target width 目标宽度 |
| heightopt | INT | 1–8192 | Target height 目标高度 |
| short_sideopt | INT | 1–8192 | Short side length 短边长度 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |