Nodes/GraftingRayman/GR Mask Resize
ComfyUI Node

GR Mask Resize

GR Mask Resize

By GraftingRayman·Created 2 years ago·Updated about a month ago· 76
GR Mask Resize
  • mask
  • MASK
width
height

The utility node in this pack's mask family that everyone eventually needs and nobody thinks about until a shape mismatch error stops their graph cold: a plain mask resize. If a mask was generated at one resolution and the image you're compositing or inpainting is a different size, this is the fix.

How it works

There isn't much to it, and that's the appeal. Feed it a mask, tell it the width and height you want, and it scales the mask to fit. No shape logic, no fit modes, no positioning - a straight resize, the same job ComfyUI's own image scale nodes do but for the MASK type specifically rather than IMAGE.

Where this actually earns its place in a graph: masks generated procedurally (by another GraftingRayman mask node, or by a segmentation/detection node) don't always come out at the exact pixel dimensions your working image is at, and most compositing or inpaint nodes expect the mask and the image to match exactly. Rather than regenerating the mask at the right size from scratch, you resize it after the fact.

The inputs and outputs that matter

  • mask (MASK, required) - the mask you're resizing.
  • width / height (INT, required) - the target dimensions.
  • MASK (output) - same mask, now sized to match, ready to wire into whatever needs the dimensions to line up.

How to install it

Via ComfyUI Manager: search "GraftingRayman", install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/GraftingRayman/ComfyUI_GraftingRayman

then restart. Every node in this pack, including this one, needs OpenAI's CLIP package installed on top of ComfyUI's own CLIP:

# portable build
.\python_embeded\python.exe -m pip install git+https://github.com/openai/CLIP.git

# system python
pip install git+https://github.com/openai/CLIP.git

Skip that step and the whole pack fails to import, this node included, despite having nothing to do with CLIP itself.

Common issues & troubleshooting

Node missing from search. Check the CLIP install above first - it's a pack-wide dependency issue, not something specific to resizing.

"Sizes do not match" errors downstream. This node exists specifically to fix that class of error. If a composite or inpaint node is complaining that your mask and image dimensions don't line up, pull the mask through this node first, setting width/height to match the image you're actually working with.

Mask edges look soft or blurry after resizing. That's a normal side effect of scaling a mask up rather than generating it fresh at the target size - the resize interpolates between pixel values, which softens hard edges. If you need a crisp edge at the new size, consider whether the mask can be regenerated at the correct resolution in the first place, rather than resized after the fact.

CategoryGraftingRayman/Mask

Inputs (3)

NameTypeDefaultDescription
maskMASK
widthINT
heightINT

Outputs (1)

NameTypeDescription
MASKMASK