Nodes/KayTool/𝙆 Image Resizer
ComfyUI Node

𝙆 Image Resizer

Resize an image and its mask together, without breaking either

By kk8bit·Created 2 years ago·Updated about a year ago· 364
𝙆 Image Resizer
  • image
  • mask
  • IMAGE
  • MASK
width0
height0
keep_ratiotrue

A resize node that also carries a mask along for the ride is more useful than it sounds. Plenty of workflows need an image and its corresponding mask kept in sync dimension-for-dimension - feed one into a resize node and forget the other, and you'll get a shape mismatch error a few nodes later that has nothing obviously to do with the resize you just did. This node resizes both at once, and if you never had a mask to begin with, it generates a blank one for you so nothing downstream breaks from a missing input.

How it works

Set width and height directly, or leave either at 0 to keep that dimension at its original size - useful when you only care about constraining one axis. keep_ratio decides whether the other dimension adjusts proportionally when you only specify one. If you didn't wire in a mask, the node quietly builds a full-black mask matching the output size rather than erroring or leaving the mask output empty - a small but genuinely useful default, since a lot of downstream nodes (inpainting, compositing) expect some mask to be present even if it's just "nothing masked."

The inputs and outputs that matter

  • image (IMAGE) - required.
  • width / height (INT, 0–8192) - target dimensions; 0 keeps the original size on that axis.
  • keep_ratio (BOOLEAN, default true) - preserve aspect ratio when only one dimension is set.
  • mask (optional, MASK) - if omitted, a same-size black mask is generated automatically.
  • IMAGE / MASK (outputs) - resized image and its (real or generated) mask, dimensionally matched.

Installing it

Comes with the whole KayTool pack: ComfyUI Manager → search KayTool → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/kk8bit/KayTool and restart. Nothing extra needed for this specific node - it's pure image math, no model, no external service.

Common issues

Leaving both width and height at their 0 default is a no-op that surprises people - the image passes through unresized, which looks like the node isn't working when actually it's doing exactly what 0/0 tells it to do. Set at least one dimension to a real value. With keep_ratio on, setting both width and height to specific, non-proportional values will still respect the aspect ratio rather than stretching to hit both numbers exactly - if you genuinely need an exact width and height regardless of distortion, turn keep_ratio off first. And if a downstream node throws a size-mismatch error even though you resized here, check whether something after this node is also touching the image or mask independently - this node keeps the two in sync at its own output, but nothing stops a later node from resizing just one of them again.

CategoryKayTool/Image

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
widthINT00–8192
heightINT00–8192
keep_ratioBOOLEANtrue
maskoptMASK

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK