Files
ausboss-ComfyUI-AusBoss/js/docs/AUSBOSS_NODES_AlignImage.md
T
ausboss 85b70389ff Add Align Image, Image Size, and LM Studio Chat
Align Image snaps width and height to a clean multiple - 16, 32,
whatever the model wants - because Qwen image models, VAEs and plenty of
samplers only behave on cleanly divisible sizes. Each mode implies its
own rounding, so there is no separate direction widget: resize rescales
to the nearest multiple, crop center-crops down, pad replicate-pads up,
and a side smaller than one multiple always grows to exactly one rather
than erroring. The new size comes out as INTs for wiring into latents.

Image Size reads width, height, longest edge and shortest edge off the
wire so resizes and latents key off the actual image instead of retyped
numbers that drift.

LM Studio Chat posts a prompt - and optionally one image - to a local
LM Studio server, or anything else speaking the OpenAI-compatible chat
API. The interface is the middle ground the installed ecosystem packs
miss on either side: endpoint string, model string where EMPTY means
whatever the server has loaded (a dropdown fetched at ComfyUI startup
goes stale whenever LM Studio was not running yet), optional system
prompt, prompt required unless an image is connected, temperature,
max_tokens, seed as the re-roll knob, a timeout, and an image downscale
cap. Reasoning-model think blocks land on their own output so the text
stays clean for conditioning. Stdlib urllib only - no new dependencies -
and the POST runs off the executor thread. Every error names what to
fix, with the server's own words when it had any.

Verified live against a running LM Studio: a JIT-loaded qwen3.5-9b
answered a text round trip in 7.6 s through the real node; the
no-model-loaded 400 and a dead port both surfaced their actionable
messages. The vision payload shape is unit-tested; the two local VL
quants refused images server-side (missing projector / failed load), so
the live vision check stays on the deployment checklist.

48 offline tests cover the alignment math, both size nodes, the URL and
payload builders, think-splitting, image encoding, and every mocked
network error path.
2026-08-15 20:51:51 -05:00

1.6 KiB

Align Image

Snaps an image's width and height to a clean multiple of a number you pick — 8, 16, 32, 64, whatever the model downstream wants. Qwen image models, VAEs, and plenty of samplers behave best (or only work) on sizes that divide cleanly; this node makes any input legal without hand-typing resolutions.

Controls

  • image: BHWC batch to align; every frame is treated the same.
  • multiple: Both output sides come out divisible by this. 16 or 32 suits most diffusion models; latent nodes generally want at least 8.
  • mode: How the multiple is reached. Each mode implies its own rounding direction, so there is no separate rounding widget:
    • resize — rescale to the nearest multiple. A slight stretch, but every pixel's content survives. The default.
    • crop — center-crop down to the next multiple. No distortion; a few edge pixels are trimmed.
    • pad — replicate-pad the edges up to the next multiple, split evenly. No distortion; a few edge pixels are invented by repetition.

A side already smaller than one multiple can never be cropped legal, so it snaps up to exactly one multiple in every mode (replicate-padded when the mode would otherwise shrink it).

Outputs

  • image: The aligned batch.
  • width / height: The new size as INTs — wire them into an Empty Latent, a resize, or conditioning nodes so the numbers can never drift from the actual image.

Notes

At most multiple - 1 pixels are added or removed per side, so the change is invisible at 16 or 32 on normal resolutions. Batches keep their frame count; values stay in [0, 1].