Nodes/ComfyUI-WJNodes/image scale pixel option
ComfyUI Node

image scale pixel option

The advanced settings panel for image scale pixel v2

By 807502278·Created 2 years ago·Updated 11 months ago· 21
image scale pixel option
  • refer_to
  • s
scaleoriginal
size_modecrop
crop_bbox_method_widthcenter
crop_bbox_method_hightcenter
fill_color#ffffff
round_widthround
round_hightround
methodLANCZOS
Enable_TotalPixelstrue
any_alignment0

image_scale_pixel_option doesn't resize anything by itself - it's a settings bundle you plug into image_scale_pixel_v2's option input when the defaults on that node aren't enough. Skip it entirely and image_scale_pixel_v2 behaves the same as if you'd connected this node with every setting left at its own default; connect it only once you need to control how the target size gets reached, not just what the target is.

It's part of the small ratio toolset inside ComfyUI-WJNodes, a large personal utility pack from GitHub user 807502278 that spans cropping, video slicing, color tools, and file operations.

How it works

The core scaling node picks a total pixel budget and an alignment multiple, but doesn't otherwise decide how to get an odd-shaped source image to a specific target aspect ratio. This node fills that gap: pick a target scale (a ratio like "16:9" or "original" to keep the source's own proportions), then decide what happens when the source doesn't already match - fill the frame and let content spill past the edges, crop to fit, or pad out to a bounding box with a fill color. It also controls the resample filter and how fractional pixel counts get rounded.

The inputs and outputs that matter

  • scale (default original) - target aspect ratio: original, 1:1, 3:4, 4:3, 2:3, 3:2, 9:16, or 16:9.
  • size_mode (default crop) - how the image reaches that ratio: fill, crop, or bbox (pad out to a bounding box).
  • crop_bbox_method_width / crop_bbox_method_hight (both default center) - which edge the crop or bbox padding favors on each axis (center, left/right, up/down).
  • fill_color (default #ffffff) - the padding color used in bbox mode.
  • round_width / round_hight (both default round) - how fractional pixel counts get rounded: round, ceil, or floor.
  • method (default LANCZOS) - the resample filter used for the actual resize.
  • Enable_TotalPixels (default on) - leave this on to respect the pixel budget set on image_scale_pixel_v2; the description notes turning it off makes the node crop/fit to your chosen ratio using the original image size instead of the target pixel budget.
  • any_alignment (default 0, meaning no override) - set this above 0 to override whatever alignment multiple you picked on the main node, for an arbitrary integer alignment instead of the preset list.
  • refer_to (optional, * type) - connect another image, mask, or latent here to borrow its size directly, overriding the scale ratio setting entirely.

Output is a single s (an SO-typed bundle) that plugs straight into image_scale_pixel_v2's option input - nothing else consumes it.

How to install it

Via ComfyUI Manager, search "ComfyUI-WJNodes." Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git

Restart ComfyUI. No models needed - this is a settings node, nothing runs inference.

Common issues & troubleshooting

Connecting this node changed nothing. Its defaults are explicitly designed to match image_scale_pixel_v2's own built-in defaults, so if you haven't changed any of its settings, connecting it shouldn't alter behavior - the whole point is you only need it once you deviate from a default.

Output resolution ignores your TotalPixels setting from the main node. Check Enable_TotalPixels - if it's off, the description says the node crops/fits to your target ratio using the original image size rather than respecting the pixel budget on image_scale_pixel_v2.

Padded regions show up in a color you didn't expect. That's fill_color, only relevant in bbox size mode, defaulting to white (#ffffff) rather than black or transparent.

Alignment override doesn't seem to apply. any_alignment only takes effect above 0 - left at its default of 0, the main node's own alignment dropdown selection is used instead, not overridden.

No outside reference for this specific settings node. It's a companion to a niche resize node in a personal pack with no public discussion - when in doubt, test one setting change at a time against the main node's output rather than adjusting several at once.

CategoryWJNode/ImageEdit/ratio

Inputs (11)

NameTypeDefaultDescription
scaleCOMBOoriginal8 options: original, 1:1, 3:4, 4:3, 2:3, 3:2, +2
size_modeCOMBOcrop3 options: fill, crop, bbox
crop_bbox_method_widthCOMBOcenter3 options: center, left, right
crop_bbox_method_hightCOMBOcenter3 options: center, up, down
fill_colorSTRING#ffffff
round_widthCOMBOround3 options: round, ceil, floor
round_hightCOMBOround3 options: round, ceil, floor
methodCOMBOLANCZOS6 options: LANCZOS, BILINEAR, BICUBIC, BOX, HAMMING, NEAREST
Enable_TotalPixelsBOOLEANtrue
any_alignmentINT00–8192
refer_toopt*

Outputs (1)

NameTypeDescription
sSO