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.
887 B
887 B
Image Size
Reads an image's dimensions and hands them out as INTs: width, height, longest_edge, and shortest_edge.
Wire them wherever a workflow wants numbers that must match the actual image — an Empty Latent sized to the source, a resize keyed off the longest edge, aspect-aware math with the shortest. Because the values come off the wire, they can never drift out of date the way retyped numbers do.
Outputs
- width / height: The frame size in pixels.
- longest_edge:
max(width, height)— the number resize-to-fit logic keys on. - shortest_edge:
min(width, height)— the number crop-to-fill and many preprocessing pipelines key on.
Notes
A batch reports the size its frames share (IMAGE batches are uniform by construction). The node does no work worth caching or canceling — it reads two numbers off the tensor's shape.