XImageResize
One resize node that won't fight your batch or your divisibility
- image_or_mask
- resize_settings_in
- Processed_Data
- width
- height
- resize_settings_out
Resizing sounds like the least interesting thing you can do to an image, and then you hit a batch where every frame has a different size and your VAE or model quietly refuses. XImageResize is this pack's attempt to make resize boring in the good way: it handles images or masks, scales by long edge, short edge, megapixels, or a multiplier, snaps to a divisibility requirement (so the result plays nice with 8/16/32/64-based models), and - the part that stands out - can propagate its settings to downstream resize nodes so a whole chain resizes to the same target instead of drifting.
How it works
You feed it image_or_mask (a MatchType port) and it returns the resized data plus the resulting width and height. The scale_mode dropdown picks your interpolation: Nearest-exact (fastest), Bilinear (fast, medium quality), Area (best for downsampling), Bicubic (high quality), or Lanczos (highest quality, slowest). The tooltip carries the one tip that matters for masks: use Nearest-exact for MASK input to avoid edge drift on the mask boundary - a real, practical detail that most resize nodes don't bother telling you.
The scaling behavior is chosen by edge_mode:
- Long - fit the long edge to
target_edge(default 1280). - Short - fit the short edge.
- Megapixels - hit a target pixel count (0.1–100 MP).
- Scale Multiplier - plain 1.0–10.0 multiply.
resize_condition gates Long/Short/Megapixels modes: Always, Only if Larger, or Only if Smaller. Note the subtlety in the tooltip - if the condition isn't met, resizing is skipped, but divisible and offset are still applied, so you don't silently get an off-model resolution.
The batch-unified bit
The genuinely clever feature is the settings chain. A node has resize_settings_in (optional, from an upstream XImageResize) and resize_settings_out, carrying an XZ3R0_RESIZE_SETTINGS type. With use_passed_settings on, a downstream node inherits the chain-origin settings for its calculation; with output_resize_settings on, the settings keep forwarding. The point: set your target once at the head of a chain and every downstream resize obeys the same target - which is exactly what you want when every image in a batch has to land on the same canvas. This is the "resize coordinator" pattern, and it's the reason to reach for this node over the built-in ImageScale.
Inputs that matter
- scale_mode / edge_mode / resize_condition / target_edge - the main scaling controls.
- divisible (default 16) with divisible_mode (Nearest/Up/Down) - snap resolution to a multiple; set to 1 to disable.
- width_offset / height_offset (-128 to +128) - nudge the result, e.g. to make room for an inpaint pad.
- use_passed_settings / output_resize_settings - the chain logic above.
Outputs: Processed_Data (resized image or mask), width, height, resize_settings_out.
Installing it
Part of ComfyUI-Xz3r0-Nodes. ComfyUI Manager: search ComfyUI-Xz3r0-Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Xz3r0-M/ComfyUI-Xz3r0-Nodes.git
cd ComfyUI-Xz3r0-Nodes
pip install -r requirements.txt
Restart ComfyUI. No FFmpeg needed for this node.
Gotchas
The most common miss is forgetting that divisible adjustment still happens even when resize_condition skips the resize - if your image comes out a hair different than you computed by hand, that's usually the divisibility snap. And mind the mask rule: a mask resized with a smooth filter picks up soft edges that change what the mask means. One honest note from the KB: resizing is not upscaling - a resize node adds no detail, it just interpolates. For "make it bigger and better," you pair this with a real upscaler, not a resize.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| image_or_mask | COMFY_MATCHTYPE_V3 | Input image or mask | |
| use_passed_settings | BOOLEAN | true | When enabled and settings input is connected, use passed settings for this node's resize calculation. When disabled, this node uses local panel values only. |
| output_resize_settings | BOOLEAN | true | When disabled, resize_settings_out outputs empty value, equivalent to leaving this port unconnected. |
| scale_mode | COMBO | Bilinear | Select interpolation algorithm: Nearest-exact=fastest, Bilinear=fast & medium quality, Area=best for downsampling, Bicubic=medium speed & high quality, Lanczos=slow & highest quality. For MASK input, Nearest-exact is recommended to avoid edge drift. |
| edge_mode | COMBO | Long | Select scaling mode: Long=long edge, Short=short edge, Megapixels=target pixels, Scale Multiplier=scale by multiplier |
| resize_condition | COMBO | Always | Resize condition for Long/Short/Megapixels: Always=always resize, Only if Larger=resize only when image is larger than target, Only if Smaller=resize only when image is smaller than target. Ignored in Scale Multiplier mode. If the condition is not met, resizing is skipped, but divisible and offset are still applied. |
| target_edge | INT | 128064–8192 | Target edge length in pixels (ignored in Megapixels and Scale Multiplier modes) |
| megapixels | FLOAT | 1.00.1–100 | Only used in Megapixels mode as target value (must be >0) |
| scale_multiplier | FLOAT | 1.00.1–10 | Scale multiplier (only used in Scale Multiplier mode) |
| divisible_mode | COMBO | Disabled | How to adjust resolution to be divisible: Disabled=no adjustment, Nearest=round to nearest multiple, Up=round up, Down=round down |
| divisible | INT | 161–128 | Make resolution divisible by this number (set to 1 to disable, common values: 8, 16, 32, 64) |
| width_offset | INT | 0-128–128 | Add offset to output width (positive=increase, negative=decrease, default=0) |
| height_offset | INT | 0-128–128 | Add offset to output height (positive=increase, negative=decrease, default=0) |
| skip_on_empty | BOOLEAN | false | When enabled, outputs None for all ports if no input image is connected, instead of raising an error. |
| resize_settings_inopt | XZ3R0_RESIZE_SETTINGS | Optional resize settings from previous XImageResize node |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| Processed_Data | COMFY_MATCHTYPE_V3 | Resized image or mask output tensor |
| width | INT | Output resolution width |
| height | INT | Output resolution height |
| resize_settings_out | XZ3R0_RESIZE_SETTINGS | Settings passed to downstream nodes. If valid upstream settings exist, this output keeps forwarding the chain-origin settings. |