AIHub Utils Scale Image And Masks
The same normalizer, but on tensors already inside your workflow
- images
- masks
- IMAGE
- MASK
- WIDTH
- HEIGHT
AIHubUtilsScaleImageAndMasks is the runtime half of the otavanopisto ComfyUI-aihub-workflow-exposer normalizer story. AIHubUtilsNewNormalizer builds a normalizer object for preprocessing - it gets fed into an image batch expose so incoming images are sized before they become tensors. This node runs the same logic but directly, on tensors that already exist in your graph. The README is upfront about what that means: "In practise this is basically just an upscaler/downscaler, just that it also works with masks."
So the honest summary is: it's an image resize node, with two extras. It handles masks in lockstep, and it tells you what it did (outputs the resulting width and height). If you don't need mask handling, the README says it plainly - "the simple method of using image scale shall work best." Reach for this when you're scaling an image and its mask together and need them to stay perfectly aligned.
The inputs that matter
- images (IMAGE) - the batch to resize.
- normalize_at_width / normalize_at_height - the target size. Unlike the preprocessing normalizer, both must be greater than 0 here - the source raises an error otherwise. There's no "auto-pick the largest" mode for tensors; you're on tensors, you declare the size. (The "Must be greater than 0" tooltip on the inputs is the author flagging this exact trap.)
- normalize_upscale_method -
nearest-exact(default),bilinear,area,bicubic,lanczos. Same advice as the sibling node: don't upscale photos withnearest-exact. - masks (MASK, optional) - masks to resize in lockstep. If given, the count must match the images or the source raises "The number of masks must match the number of images."
Outputs: IMAGE, MASK (the resized pair), WIDTH, HEIGHT (the actual size it landed on). Those last two are handy if the size feeds into an empty latent or a resolution-dependent node.
How it behaves
The source instantiates the same Normalizer class and runs it with is_tensor=True, which forces explicit dimensions, resizes each image (and its matching mask) with common_upscale using center-crop, and concatenates the batch. Masks are treated as single-channel and resized with the same method, so they stay pixel-aligned with their images - the whole reason the node exists.
Gotchas
The zero-size check is the #1 trip: leaving the defaults at 0 (as copied from the sibling node) errors immediately. Set both, set them deliberately. And remember it's center-crop resampling - if you need aspect-ratio-preserving scaling, this isn't that node; it stretches to the exact target.
Install
No requirements:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
Restart ComfyUI. Small, specific, and genuinely useful whenever an image and its mask must scale together without drifting apart.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | The list of images to normalize | |
| normalize_at_width | INT | 0 | Must be greater than 0 |
| normalize_at_height | INT | 0 | Must be greater than 0 |
| normalize_upscale_method | COMBO | nearest-exact | The method to use when upscaling images |
| masksopt | MASK | The list of masks to normalize, if given must match the number of images |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| WIDTH | INT | — |
| HEIGHT | INT | — |