Resize By Image
Resize one image to match another's dimensions, no manual numbers
- reference_image
- input_image
- IMAGE
A small convenience node: instead of reading a reference image's dimensions off a node somewhere and typing width/height into a resize node by hand, you just wire the reference image straight in and let this node match it for you.
How it works
It reads reference_image's height and width and resizes input_image to match, using bilinear interpolation. If you don't wire anything into input_image at all - it's an optional input - the node doesn't error, it just returns a black image at reference_image's dimensions instead. That's a genuinely useful default while you're still building out a graph and haven't connected the real source yet, though it's also the thing to watch for below.
The inputs and outputs that matter
reference_image- the image whose dimensions you want to match. Required.input_image- the image that actually gets resized. Optional; leave it disconnected and you get a same-sized black image back instead.
Output: a single IMAGE, at reference_image's exact dimensions.
What it's actually for
Anywhere you need two images the same size before they can be composited, masked together, or fed into a node that expects matching dimensions - matching a generated image to whatever produced your ControlNet condition, lining up a Modelscopev2v output (same pack) with a reference frame, or just avoiding the manual step of reading one node's resolution and typing it into another.
Installing it
Search cspnodes in ComfyUI Manager, or clone it directly:
cd ComfyUI/custom_nodes
git clone https://github.com/cerspense/ComfyUI_cspnodes
Restart after. The pack imports diffusers and pymediainfo unconditionally at the top of its single Python file, for the video and metadata nodes elsewhere in the pack. This node needs neither, but if either import fails, cspnodes disappears from your node list entirely - check the startup log for that before assuming something's specifically wrong with this node.
Where people get tripped up
The resize is always a straight bilinear stretch - there's no aspect-ratio-preserving mode, no letterboxing, no cropping. If reference_image and input_image have noticeably different aspect ratios, expect visible stretching in the output; that's the only mode this node has.
And the black-image fallback described above is convenient right up until it isn't: if you forgot to actually wire something into input_image, you won't get an error telling you so - you'll just get a plain black frame the right size, silently, and it's easy to not notice until several nodes downstream when something looks wrong for no obvious reason. Worth double-checking the connection if a ResizeByImage output ever looks suspiciously flat.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| reference_image | IMAGE | — | |
| input_imageopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |