Align Image π
The 'why won't this sampler take my size' fix
- image
- image
- width
- height
You know the error. You load a 1346Γ932 image, feed it into a model that wants cleanly divisible dimensions, and get a cryptic refusal or a silently stretched result. Align Image π is the two-second fix: it snaps width and height to a multiple you pick - 8, 16, 32, whatever the model demands - and hands you the new size as INTs so everything downstream stays consistent.
It's a small node doing one job, but that job shows up everywhere once you're not running square 1024s. Qwen image models, VAEs, and a lot of samplers genuinely behave better on divisible sizes, and most workflows end up hand-typing "make it a multiple of 8" into a resize node and praying they did the math right. This just does it.
What you actually set
Three inputs matter. The multiple widget (default 16) is the divisibility target - latent-space work usually wants at least 8. Then mode decides how it gets there, and the distinction is worth understanding because each one costs you something different:
- resize rescales to the nearest multiple. Slight stretch, but no content lost. Default, and fine for most cases.
- crop center-crops down to the next multiple. No distortion, but you lose edges.
- pad replicate-pads up to the next multiple. No distortion, no loss - but you add edge pixels.
In crop and pad modes you can also pin which side survives (crop_position, pad_position) and what fills the new area (pad_fill, with pad_color if you want a solid instead of stretched edge pixels).
The outputs are the good part. You get image, plus width and height INTs you can wire straight into latent or resize nodes so the number can't drift from the picture. And there's offset_x/offset_y - where the original's top-left corner landed in the output: positive after padding, negative after cropping, zero after resize. Wire those into a crop later and you can un-align an image back to its original framing after sampling, which is how you'd use pad mode to buy sampler-friendly dimensions and still ship a normal-size result.
The gotchas
Resize stretches. If you're doing a character render where proportions matter, crop is the better default - a couple of edge pixels are a much cheaper price than a 3% width stretch. And don't forget the obvious: a side smaller than one multiple always grows to exactly one multiple, so a tiny 30px-wide strip becomes 32px. That's intended, but it surprises people the first time.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/ausboss/ComfyUI-AusBoss.git
Restart ComfyUI, then search for AusBoss - it's also in ComfyUI Manager under the pack title. The pack has no extra Python dependencies (it uses Pillow, NumPy, and Torch that ship with ComfyUI) and declares a minimum of ComfyUI 0.27.1. After a frontend update, hard-refresh the browser with Ctrl+Shift+R.
Troubleshooting
If the aligned result still gets rejected, the model probably wants a bigger or different multiple than the default 16 - check its card or workflow notes. If a resize is producing visibly soft output, switch to crop or pad so you're not resampling pixels at all. And if you're feeding this into a latent node, remember 8 is the practical floor; 16 is safer for Qwen-class encoders.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | BHWC image batch to align. | |
| multiple | INT | 161β1024 | Width and height come out divisible by this. 16 or 32 suits most diffusion models; latent-space nodes usually want at least 8. |
| mode | COMBO | resize | How 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_positionopt | COMBO | center | Crop 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_positionopt | COMBO | center | Pad mode only: where the image sits on the grown canvas β the new pixels land on the opposite side. center splits them evenly. |
| pad_fillopt | COMBO | replicate | Pad mode only: what fills the new area. replicate stretches the edge pixels out; color uses pad_color as a solid. |
| pad_coloropt | STRING | #000000 | Solid fill for pad_fill: color. Hex, R,G,B numbers, or a CSS color name. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The aligned batch; both sides are multiples of the chosen number. |
| width | INT | Aligned width in pixels. |
| height | INT | Aligned height in pixels. |