Nodes/rgthree's ComfyUI Nodes/Image Resize (rgthree)
ComfyUI Node Runs on cloud

Image Resize (rgthree)

Image Resize (rgthree)

By rgthree·Created 3 years ago·Updated 12 days ago· 3,294
Image Resize (rgthree)
  • image
  • IMAGE
  • WIDTH
  • HEIGHT
measurement
width0
height0
fit
method

Image Resize does the one job its name promises, but with the two knobs that actually matter in practice: a fit mode so you control what happens when the aspect ratio doesn't match, and a choice of interpolation method so you're not stuck with whatever default a simpler node picked. And usefully, it hands back the final width and height as numbers, so you can feed the real dimensions to the rest of your graph.

Why you'd reach for it

Resizing sounds trivial until an aspect ratio bites you. You want to force an image to 1024×1024 but it's a portrait - do you crop it, pad it with bars, or shrink it to fit inside? Most basic resize nodes make that decision for you and you find out when the output looks wrong. This node makes it explicit. It also returns the resulting dimensions as outputs, which matters more than it sounds: a lot of workflows need to know the size they just produced to set up the next stage (an upscale target, a latent, a paste-back), and having the numbers right there saves a separate "get image size" node.

It's a workhorse rather than a headline node - the kind of quality-of-life utility rgthree fills the pack with. Nothing here generates; it just makes the pipeline tidy and predictable.

Inputs and outputs

The required inputs are worth understanding as a set, because they interact:

  • image - the image to resize.
  • measurement - pixels or percentage. This decides how to read the width/height fields: as literal pixel targets, or as a percent scale of the original.
  • width / height - the target values, interpreted per the measurement setting. Range runs up to 16384, so there's headroom for big canvases.
  • fit - the important one: crop (fill the target box and trim the overflow), pad (fit inside and add bars), or contain (scale to fit within the box, keeping the whole image). This is your aspect-ratio policy.
  • method - the interpolation kernel: nearest-exact, bilinear, area, bicubic, or lanczos. For downscaling, area and lanczos tend to look cleanest; nearest-exact is for when you specifically want hard pixel edges (pixel art, masks).

Outputs are IMAGE (the resized result) plus WIDTH and HEIGHT as integers - wire those into whatever needs the final dimensions.

Installing it

Image Resize is part of rgthree-comfy. Install via ComfyUI Manager (search rgthree's ComfyUI Nodes) or clone the repo:

cd ComfyUI/custom_nodes
git clone https://github.com/rgthree/rgthree-comfy.git

Restart ComfyUI afterward. No model files, no heavy Python dependencies - the pack is graph and UI code, so install is just the clone and a restart.

Common issues

The most common surprise is fit mode doing something you didn't expect when the aspect ratios differ. If your output is getting cropped and you wanted the whole image, you're on crop and want contain or pad. If you're getting unexpected bars, you're on pad. There's no wrong setting - just make sure it matches your intent, because the node won't guess.

Second, watch the measurement toggle: setting width/height to 512 means 512 pixels in pixel mode but 512 percent (a 5× blow-up) in percentage mode. Mismatched expectations here produce either a tiny thumbnail or a giant image.

Third, remember this resizes a pixel image, not a latent - if you're trying to change generation resolution before sampling, you want an empty latent at the right size, not a post-hoc image resize. This node is for images you already have.

And the pack-wide note: if the node renders oddly, check whether ComfyUI's Nodes 2.0 frontend is enabled. The Vue rewrite broke several rgthree nodes, and the community's standing workaround is to keep it off.

Categoryrgthree

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
measurementCOMBO2 options: pixels, percentage
widthINT00–16384The width of the desired resize. A pixel value if measurement is 'pixels' or a 100% scale percentage value if measurement is 'percentage'. Passing '0' will calculate the dimension based on the height.
heightINT00–16384
fitCOMBO'crop' resizes so the image covers the desired width and height, and center-crops the excess, returning exactly the desired width and height. 'pad' resizes so the image fits inside the desired width and height, and fills the empty space returning exactly the desired width and height. 'contain' resizes so the image fits inside the desired width and height, and returns the image with it's new size, with one side liekly smaller than the desired. Note, if either width or height is '0', the effective fit is 'contain'.
methodCOMBO5 options: nearest-exact, bilinear, area, bicubic, lanczos

Outputs (3)

NameTypeDescription
IMAGEIMAGE
WIDTHINT
HEIGHTINT