Nodes/GraftingRayman/GR Image Resize
ComfyUI Node

GR Image Resize

The lean resize node — longest side, divisible-by, and a scale factor

By GraftingRayman·Created 2 years ago·Updated about a month ago· 76
GR Image Resize
  • image
  • image
  • height
  • width
  • scale_factor
width100
height100
image_dimensions
longest_sidefalse
longest_side_value256
divisible_by1
scale_factor1.000

This is the standalone resize node in the pack - no interpolation-method dropdown like its sibling GR Image Resize Methods, no latent/preset machinery like GR Image Size. Just an image, a target size, and the handful of controls that actually matter for getting dimensions right: a longest-side constraint, a divisible-by snap, and a scale factor. If you've ever had a generation fail or come out wrong because your resized image landed on an odd width like 513 instead of 512, this node's divisible_by input exists specifically to stop that from happening to you.

How it works

You give it a width and height as the base target, then layer optional constraints on top. longest_side (when enabled) resizes so the image's longer edge hits longest_side_value, keeping proportions intact - useful when you don't know or care about the exact aspect ratio, just the maximum dimension. divisible_by rounds the final size to a multiple of whatever you set, which matters because most diffusion pipelines expect width and height divisible by 8 (and some, particularly video models, want 16 or more) - feed them an odd size and you'll get a shape-mismatch error or silent padding you didn't ask for. scale_factor applies a straight multiplier on top of everything else.

The inputs and outputs that matter

  • image, width, height - required. Width and height default to 100, so set them deliberately; the defaults are placeholders, not sensible generation sizes.
  • image_dimensions - a boolean toggle. Based on the name, it switches between using the width/height you set versus reading dimensions off the incoming image itself. If your output size doesn't match what you expected, this is the first input to check.
  • longest_side / longest_side_value (default 256) - enable to constrain by the longer edge instead of exact width/height.
  • divisible_by (default 1, meaning no rounding) - set to 8 or 64 depending on what your downstream model expects.
  • scale_factor (default 1) - a multiplier on top of the computed size.

Outputs: image (the resized result), height, width (the actual final dimensions after all the constraints above are applied - handy for wiring into a latent node downstream so it matches exactly), and scale_factor (echoing back what was actually used).

How to install it

Via ComfyUI Manager, search GraftingRayman. Or manually:

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

Restart afterward. The whole pack needs OpenAI's CLIP installed separately or nothing imports - portable ComfyUI: .\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.

Common issues & troubleshooting

Nodes missing after install. Check your startup console for a CLIP import error - this pack shares one module, so a missing CLIP install takes every node in it down, not just the vision ones. Run the pip command above.

Downstream sampler or VAE errors after resizing. Almost always a dimension that isn't a multiple of 8 (or 16/64 for some video pipelines). Set divisible_by to match what your model expects instead of leaving it at the default of 1.

Resize doesn't respect your width/height at all. Check image_dimensions - if it's reading size from the source image instead of your inputs, that's the toggle to flip.

Output size is smaller or larger than expected with longest_side on. Remember longest_side_value constrains the longer edge specifically, so a portrait and a landscape image with the same setting will come out with different width/height pairs - that's by design, not a bug.

CategoryGraftingRayman/Images

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
widthINT100
heightINT100
image_dimensionsBOOLEAN
longest_sideBOOLEANfalse
longest_side_valueINT256
divisible_byINT1
scale_factorFLOAT1.000

Outputs (4)

NameTypeDescription
imageIMAGE
heightINT
widthINT
scale_factorFLOAT