Nodes/ComfyUI-MakkiTools/Image_Resize(mki-图像大小调整)
ComfyUI Node

Image_Resize(mki-图像大小调整)

A resize node that doubles as a resolution calculator

By MakkiShizu·Created about a year ago·Updated 7 months ago· 9
Image_Resize(mki-图像大小调整)
  • image
  • image
  • width
  • height
upscale_methodauto
crop_methodcenter
size1024
GCD1
width
height
short_side

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 roughly size × size pixels, 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: area when shrinking, lanczos when enlarging, nearest-exact when nothing changes. Or force one: nearest-exact, bilinear, area, bicubic, lanczos.
  • crop_method - disabled or center.
  • 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.

CategoryMakkiTools

Inputs (8)

NameTypeDefaultDescription
upscale_methodCOMBOautoMethod to upscale the image 图像放大方法
crop_methodCOMBOcenterMethod to crop the image 图像裁剪方法
sizeINT10241–8192Target size (based on selected dimension) 目标尺寸(基于选定的维度)
GCDINT11–512Greatest Common Divisor constraint 最大公约数约束
imageoptIMAGEInput image 输入图像
widthoptINT1–8192Target width 目标宽度
heightoptINT1–8192Target height 目标高度
short_sideoptINT1–8192Short side length 短边长度

Outputs (3)

NameTypeDescription
imageIMAGE
widthINT
heightINT