RC Canvas Resize
Grow the canvas, keep the image — without math
- image
- IMAGE
Resizing an image and resizing a canvas are two completely different operations, and the difference matters constantly in compositing. Scaling the image squishes your pixels. Growing the canvas adds space around them - which is exactly what you need when you want room for a watermark, a caption bar, a drop shadow, or a second image to composite against. RC Canvas Resize is the latter: it resizes the canvas and repositions the existing image inside it, leaving the pixels untouched.
It's a utility from the RC Image Compositor pack, and once you've used it once you'll keep finding excuses for it.
How it works
You give it a new canvas size and an anchor position, and the node places the original image at that anchor, filling the rest with a solid background color. The clever bit is the anchor system - nine positions (center, all four corners, all four edges) plus independent X and Y pixel offsets, so you can reliably park an image at, say, top-left with a 50px margin without doing any coordinate arithmetic in your head.
Background color is set with three floats (r, g, b), each 0–1. Default is black, which is a trap if you forget to change it - a black matte behind a bright image looks broken until you realize it's the fill color.
The inputs that matter
- image - the input tensor.
- new_width / new_height - target canvas size in pixels (64–8192).
- anchor - where the original image sits in the new canvas: center, top_left, top_center, top_right, middle_left, middle_right, bottom_left, bottom_center, bottom_right.
- x_offset / y_offset - fine-tune in pixels, can be negative.
- background_color_r/g/b - the fill color, 0–1 floats. Black by default.
Output is a single IMAGE tensor with the new dimensions.
How to install it
Ships with the RC Image Compositor pack:
cd ComfyUI/custom_nodes
git clone https://github.com/kj863257/ComfyUI_RC_Image_Compositor
cd ComfyUI_RC_Image_Compositor
pip install -r requirements.txt
Restart ComfyUI, or install via ComfyUI Manager by searching "RC Image Compositor". Just pillow, numpy, and opencv-python - no models.
Common issues
The first stumble is confusing this with scaling. If you set new dimensions smaller than the image, the image gets cropped, not squished - the canvas shrinks around the anchor point. That's the intended behavior; if you wanted to downscale, use RC Image Scale instead.
The second is the solid-color background. Unlike the pack's RC Canvas Padding node, which offers edge/mirror/transparent fills, Canvas Resize only does flat color. For transparent padding you'll want RC Canvas Padding with fill_mode=transparent. And remember the color floats are 0–1, not 0–255 - typing 255 for white gives you a clamped 1.0, which happens to work, but typing 128 expecting mid-gray gives you pure white. Keep it in 0–1 and you're fine.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| new_width | INT | 51264–8192 | New canvas width |
| new_height | INT | 51264–8192 | New canvas height |
| anchor | COMBO | center | Image anchor position in new canvas: - center: Center - top_left: Top-left corner - top_center: Top center - top_right: Top-right corner - middle_left: Middle left - middle_right: Middle right - bottom_left: Bottom-left corner - bottom_center: Bottom center - bottom_right: Bottom-right corner |
| x_offset | INT | 0-4096–4096 | Additional X offset (pixels) |
| y_offset | INT | 0-4096–4096 | Additional Y offset (pixels) |
| background_color_r | FLOAT | 0.000–1 | Background color red component |
| background_color_g | FLOAT | 0.000–1 | Background color green component |
| background_color_b | FLOAT | 0.000–1 | Background color blue component |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |