Nodes/ComfyUI-AusBoss/Align Image πŸ†Ž
ComfyUI Node

Align Image πŸ†Ž

Snaps an image's width and height to a clean multiple of a number you choose β€” 8, 16, 32, whatever the model wants. Qwen image models, VAEs, and many samplers behave best on cleanly divisible sizes. Resize rescales to the nearest multiple, crop center-crops down, pad replicate-pads the edges up; the new size comes out as INTs for wiring into latent nodes.

By ausbossΒ·Created about a month agoΒ·Updated 7 days agoΒ· 2
Align Image πŸ†Ž
  • image
  • image
  • width
  • height
  • offset_x
  • offset_y
β—„multiple16β–Ί
β—„moderesizeβ–Ί
β—„crop_positioncenterβ–Ί
β—„pad_positioncenterβ–Ί
β—„pad_fillreplicateβ–Ί
β—„pad_color#000000β–Ί
CategoryπŸ†Ž AusBoss/Image

Inputs (7)

NameTypeDefaultDescription
imageIMAGEBHWC image batch to align.
multipleINT161–1024Width and height come out divisible by this. 16 or 32 suits most diffusion models; latent-space nodes usually want at least 8.
modeCOMBOresizeHow to reach the multiple. resize rescales to the NEAREST multiple (slight stretch, keeps every pixel's content). crop center-crops DOWN to the next multiple (no distortion, trims edges). pad replicate-pads UP to the next multiple (no distortion, adds edges). A side smaller than one multiple always grows to exactly one.
crop_positionoptCOMBOcenterCrop mode only: which part of the frame survives. center trims both edges evenly; top, bottom, left, or right pin that edge and trim the opposite one. Ignored by resize and pad.
pad_positionoptCOMBOcenterPad mode only: where the image sits on the grown canvas β€” the new pixels land on the opposite side. center splits them evenly.
pad_filloptCOMBOreplicatePad mode only: what fills the new area. replicate stretches the edge pixels out; color uses pad_color as a solid.
pad_coloroptSTRING#000000Solid fill for pad_fill: color. Hex, R,G,B numbers, or a CSS color name.

Outputs (5)

NameTypeDescription
imageIMAGEThe aligned batch; both sides are multiples of the chosen number.
widthINTAligned width in pixels.
heightINTAligned height in pixels.
offset_xINTWhere the original's left edge sits in the output: positive after padding, negative after cropping, 0 after a resize β€” wire into a crop to un-align after sampling.
offset_yINTWhere the original's top edge sits in the output: positive after padding, negative after cropping, 0 after a resize.