ComfyUI Node

Resize Image

Crop, pad and snap to the pixel grid without doing the arithmetic

By swqa7697·Created 10 days ago·Updated about 10 hours ago· 8
Resize Image
  • image
  • mask
  • image
  • mask
width512
height512
resize_methodlanczos
modestretch
pad_color0, 0, 0
crop_positioncenter
divisible_by2

The gap it fills

You've got a 1:1 photo and the thing downstream wants 16:9 on a specific pixel grid. Stock Upscale Image will stretch it to a size or centre-crop it to a size, and that's the entire menu. Filling a canvas means computing offsets by hand for Pad Image for Outpainting. Off-centre crops mean another node in front. Landing on the grid a model actually wants - 64 for Flux-class models, 32 for MiniMax H3's canvas - means doing the division in your head. And seeing the result means hanging a Preview Image off the end.

Resize Image does crop, scale, pad and grid-snapping in one node, then previews what came out - the "stop wiring three utility nodes to do one obvious thing" move, aimed at geometry instead of faces. It's new in September 2026, so the notes below lean on the source.

How it works

The geometry is pure stdlib - no torch - and the node just moves pixels through ComfyUI's own common_upscale on the CPU, so the resize never competes with a sampler for VRAM. It computes a plan and executes it: what to cut, what to scale to, what the canvas is, where the image sits. divisible_by rounds the output size down to a multiple, and in pad the canvas is snapped first with the image fitted inside it - 1000×500 with divisible_by 16 gives exactly 992×496. The result previews on the node the way Image Crop previews, and survives cache hits and a page reload.

The fields that matter

image is the batch in - every image gets the same geometry, so per-image fitting isn't this node. width and height are the only two on the node, both INT up to 16384, and 0 means "take it from the image": the source dimension for stretch and crop, the aspect-preserving one for resize and pad. Then the hidden settings:

  • resize_method - nearest-exact, bilinear, area, bicubic, lanczos. Default lanczos, and it should be for photos: it's an interpolator, the sharpest of the lot, and it will never invent detail the source doesn't have. Use nearest-exact when hard edges must stay exact - pixel art, upscaled masks.
  • mode - stretch (default, ignores aspect ratio, always exactly width×height), crop (largest region of the requested ratio, scaled to size), pad (fit inside, place on the canvas, fill the rest with pad_color), resize (largest aspect-correct size inside width×height; the output can end up smaller on one side, which is the point).
  • pad_color - r, g, b in 0-255, or 0.0-1.0 if any part has a decimal point (1,1,1 is near-black, 1.0,1.0,1.0 is white - an easy trap), #rrggbb, one grey value, or a name like white.
  • crop_position - center (default), top, bottom, left, right: the kept region in crop, and the side the image sits on in pad.
  • divisible_by - default 2, up to 512, 0 or 1 for none.
  • mask (optional) - follows the image through crop, scale and pad; ComfyUI's 64×64 empty-mask placeholder counts as none, and any other size is fitted to the image first.

Outputs are image and mask. The mask is the input mask resized alike with 1 over any padding - the useful half for outpainting, since it tells the next node which pixels are new.

The five settings sit behind the settings… button: real inputs, saved in the workflow, just hidden so the node stays two fields tall. They have no sockets, so feed width/height by link.

Recipes worth stealing

MiniMax H3 keyframes. H3's canvas is a multiple of 32 pixels and the hybrid node stretches first_frame to the canvas, so a 1:1 photo handed straight in gets deformed. Put Resize Image in front with mode: crop, the target size and divisible_by: 32 and the aspect matches before the model sees it. Outpainting: mode: pad, divisible_by: 32, a grey fill - the mask output marks exactly which pixels are new, replacing the hand-computed offsets for the pad node.

Install

Nothing to install beyond the pack - it declares no Python dependencies (pillow only, which ComfyUI already ships). Manager → search ComfyUI-Arisu-Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/swqa7697/ComfyUI-Arisu-Nodes.git

Restart ComfyUI. Needs ComfyUI ≥ 0.30.0 and Python ≥ 3.10.

Where people get burned

The settings button is missing and the five widgets are sitting on the node - the pack's frontend script didn't load. Check the browser console for a failed resize_image.js and hard-refresh.

Bypassing the node passes imageimage and maskmask. With nothing on the mask input, the mask output then carries nothing downstream, which can look like a silent failure.

You asked for 1024×1024 in resize and got 1024×768. That's resize doing its job - it never distorts. Use stretch for the exact box, or pad for the box and the aspect ratio.

Last thing: the node isn't an output node on its own, so it only runs when something downstream needs its output.

CategoryArisu Nodes/Common

Inputs (9)

NameTypeDefaultDescription
imageIMAGEThe batch to resize; every image gets the same geometry.
widthINT5120–16384The output width in pixels; 0 takes it from the image (keeping the aspect ratio in resize and pad).
heightINT5120–16384The output height in pixels; 0 takes it from the image (keeping the aspect ratio in resize and pad).
resize_methodCOMBOlanczosHow pixels are resampled; lanczos is the sharpest for photos, nearest-exact keeps hard edges.
modeCOMBOstretchcrop cuts the image to the aspect ratio of width x height first; pad fits it inside and fills the rest with pad_color; resize fits it inside width x height; stretch ignores the aspect ratio.
pad_colorSTRING0, 0, 0The pad fill: r, g, b (0-255, or 0.0-1.0 with a decimal point), #rrggbb, one grey value, or a colour name.
crop_positionCOMBOcenterWhere the image stays: the region kept in crop, the side the image sits on in pad.
divisible_byINT20–512Round the output size down to a multiple of this; 0 or 1 for none. pad snaps the canvas, not the image.
maskoptMASKOptional; follows the image through the crop, scale and pad. Without it the mask output marks only the padding.

Outputs (2)

NameTypeDescription
imageIMAGEThe resized batch, exactly width x height after the grid in every mode but resize.
maskMASKThe input mask resized alike, 1 over any padding; ComfyUI's 64x64 empty mask when there is neither.