π Visual Resizer (nhk)
Drop any image onto a custom canvas β resize, position, and offset with a live preview
- image
- IMAGE
Sometimes you don't want to resize an image - you want to place it. VisualResizer is the node for that: it takes any image, resizes it to whatever dimensions you set, and pastes it onto a canvas of your choosing, centered with pixel-precise offsets. Think "compose a subject into a larger frame," "prepare frames for a video pipeline at a fixed resolution," or "make everything a uniform 1024Γ1024 without a trip through a resize-and-crop dance."
It's part of nhk/image in the nhknodes pack, and it's one of the few nodes in the collection with a dedicated live preview - the frontend shows you exactly where the image lands as you drag the inputs, which makes the fiddly offset tuning painless.
How it works
For each image in the batch, the node:
- Resizes the input to exactly
image_widthΓimage_height(default 512Γ512). - Creates a canvas of
canvas_widthΓcanvas_height(default 1024Γ1024), filled black. - Pastes the resized image at the canvas center, then shifts it by
offset_x(horizontal, in pixels) andoffset_y(vertical).
So with defaults you get a 1024Γ1024 black canvas with a 512Γ512 image dead-center. offset_x = 100 slides it right, offset_y = -50 lifts it up, and so on. Because position is computed as (canvas β image) // 2 + offset, the image stays centered at zero offsets no matter what canvas size you choose. Batches are handled - each frame in the batch gets the same treatment, which is exactly what you want when prepping video frames.
The one thing to know: this is a stretch, not a fit. The node resizes the image to exactly image_width Γ image_height with no aspect-ratio preservation. A portrait image squashed into a 512Γ512 canvas gets distorted. If you want to preserve aspect ratio, resize upstream to match the canvas ratio before it arrives here.
Output: a single IMAGE tensor, the composed canvas. It's marked as an output node, so you'll see the result in the UI as you tune.
Installing
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/Enashka/ComfyUI-nhknodes
or ComfyUI Manager β search "NHK Nodes" β install β restart. Under nhk/image, no extra dependencies. If the live preview isn't showing after an update, hard-refresh the browser (Ctrl+Shift+R) - it's frontend JS.
Where people get burned
- Squished images. You expected aspect-ratio preservation; this node doesn't do that. It's a stretch-to-fit. Compute the right
image_width/image_height(or normalize upstream) if the distortion bothers you. - "My image is off-screen / cut off." Offsets are raw pixels from center - with
offset_xlarger than half the canvas, part of the image slides out of frame. There's no clamping, so what you paste is what you get. - Black corners aren't configurable. The canvas is always black - there's no background color input. If you need a different backdrop, composite onto your own background first or stack a solid-color image behind it.
- Resolution mismatch with downstream nodes. A 512Γ512 image on a 1024Γ1024 canvas produces a 1024Γ1024 output; make sure whatever you feed it into expects that size.
VisualResizer is the node you reach for when "resize" isn't the actual goal - repositioning a subject, building a fixed-size frame, or slotting images into a composition. Simple, batch-friendly, and the live preview turns what could be guesswork into a drag-and-tune experience.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image or batch to resize and position | |
| canvas_width | INT | 1024 | Width of output canvas |
| canvas_height | INT | 1024 | Height of output canvas |
| image_width | INT | 512 | Width to resize image to |
| image_height | INT | 512 | Height to resize image to |
| offset_x | INT | 0 | Horizontal offset from center (pixels) |
| offset_y | INT | 0 | Vertical offset from center (pixels) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |