Image Offset
Shave a fixed number of pixels off every side
- image
- IMAGE
Most image resize nodes think in ratios - "scale by 2x," "fit into 1024." ImageOffset thinks in absolute pixel counts: it subtracts a fixed number of pixels from every dimension and hands you the shrunken result. The offset input only goes from 0 down to −10000, so this node's entire personality is "make the image N pixels smaller."
That's a weirder operation than it sounds, and it's exactly why the node exists. If you've ever needed to strip a watermark border, shave a few pixels off a frame to land on a divisible-by-8 resolution, or trim a fixed amount of padding off the edge of a batch of images - without recomputing a scale ratio for each one - this is the tool. A ratio-based node changes the crop depending on source size; this one removes the same number of pixels every time, which is what you want when the thing you're removing is a fixed-size artifact, not a proportion.
How it works
Under the hood it's one call into ComfyUI's common_upscale: the image is resized to W + offset by H + offset using nearest-exact, with a center-crop safety. Nearest-exact keeps it fast and avoids the smoothing/ringing you'd get from bilinear on a pure shrink. The result is exact: offset = -100 on a 1024×768 image gives 924×668. Note the aspect ratio shifts slightly, because it's subtracting a fixed pixel count per dimension, not a ratio - that's the intended behavior, and the thing to remember before you use it on something where proportions matter.
offset = 0 short-circuits and returns the image untouched, so you can leave the node inline as a bypass without paying anything.
Inputs and outputs
image(IMAGE) - the input, single or batch.offset(INT, −10000 to 0, default 0) - pixels to remove per dimension. Negative = shrink. There's no positive direction; growing is the GrowMask-style problem, not this node's.
One output: IMAGE, sized (W+offset) × (H+offset).
Installing it
Part of ComfyUI-lhyNodes:
- ComfyUI Manager → search
lhyNodes→ Install, restart. - Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/lihaoyun6/ComfyUI-lhyNodes.git
python -m pip install -r ComfyUI-lhyNodes/requirements.txt
Restart ComfyUI.
Where people get burned
The name. "Offset" sounds like it should shift the image (translate it), and half the people who land here are looking for a pan/translate node - this one resizes, it doesn't move anything. The other gotcha is the aspect shift: because both dimensions lose the same pixel count, a non-square image comes out with subtly different proportions, so it's not the node to use for "make everything fit a 16:9 canvas." It's a niche, fixed-amount trimmer, and when that's what you need, it's a one-widget job that just works.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| offset | INT | 0-10000–0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |