Nodes/ComfyUI-nhknodes/πŸ“ Visual Resizer (nhk)
ComfyUI Node

πŸ“ Visual Resizer (nhk)

Drop any image onto a custom canvas β€” resize, position, and offset with a live preview

By EnashkaΒ·Created 12 months agoΒ·Updated 28 days agoΒ· 23
πŸ“ Visual Resizer (nhk)
  • image
  • IMAGE
β—„canvas_width1024β–Ί
β—„canvas_height1024β–Ί
β—„image_width512β–Ί
β—„image_height512β–Ί
β—„offset_x0β–Ί
β—„offset_y0β–Ί

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:

  1. Resizes the input to exactly image_width Γ— image_height (default 512Γ—512).
  2. Creates a canvas of canvas_width Γ— canvas_height (default 1024Γ—1024), filled black.
  3. Pastes the resized image at the canvas center, then shifts it by offset_x (horizontal, in pixels) and offset_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_x larger 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.

Categorynhk/image

Inputs (7)

NameTypeDefaultDescription
imageIMAGEInput image or batch to resize and position
canvas_widthINT1024Width of output canvas
canvas_heightINT1024Height of output canvas
image_widthINT512Width to resize image to
image_heightINT512Height to resize image to
offset_xINT0Horizontal offset from center (pixels)
offset_yINT0Vertical offset from center (pixels)

Outputs (1)

NameTypeDescription
IMAGEIMAGEβ€”