AIHub Utils New Normalizer
A recipe for making image batches one uniform size before they hit the tensor
- NORMALIZER
Here's the problem AIHubUtilsNewNormalizer solves: AIHubExposeImageBatch collects a series of images from a client - and those images are not all the same size. A video editor's frames might be, sure, but uploaded images or lora-training batches rarely are. And a PyTorch batch tensor has one height and one width for the whole thing. Something has to decide on a uniform size before those images become a tensor. That "something" is a normalizer, and this node creates one.
The node doesn't resize anything itself. It outputs a NORMALIZER object (type AIHUB_NORMALIZER) that you feed into an image batch expose, and the expose applies it to the images as they arrive - before they're converted to a tensor. It's a configuration node, a recipe, not a processor.
The inputs that matter
- normalize_at_width / normalize_at_height - the target size. Here's the nice bit: set both to 0 and the normalizer doesn't force a fixed size at all - it finds the image with the most megapixels in the batch and resizes everything to that, up or down. That's a genuinely good default for batches of mixed-resolution photos: you lose the least information. Set both to a real size (say 512×512) and everything gets squashed to it. Setting only one is an error - the source raises
ValueErrorif width and height aren't both 0 or both > 0. - normalize_upscale_method - the resampling method for when images must grow:
nearest-exact(default),bilinear,area,bicubic,lanczos. The default is the trap:nearest-exactis fast and great for masks and pixel art, but it's the worst-looking choice for upscaling photos. For real images,bicubicorlanczoswill look noticeably better;areais the sensible pick for downscaling.
Output: the NORMALIZER object, wired into the normalizer input of an image batch expose (the README points you at the batch expose's normalizer field for exactly this).
Why you'd use it
Two main cases: video and lora-training. Video workflows feed frames to a video model, which wants a consistent resolution across the batch - normalize everything to the model's expected size. Lora training from image batches (the pack explicitly lists "handling, and lora training" as image-batch use cases) needs uniform training images; normalizing to the largest by megapixels is a decent default before you do proper cropping. Either way, this node keeps the batch plumbing honest without hardcoding a resolution into your workflow.
Gotchas
The one-side-set error is the easy mistake - you must set both or neither. And remember the upscale method matters most when the target is bigger than the source; if most of your batch is larger than the target, you're mostly downscaling and the method choice is less critical.
Install
No requirements, like the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/otavanopisto/ComfyUI-aihub-workflow-exposer
Restart ComfyUI. It's a tiny configuration node, but it's also the one that decides whether your image batch arrives usable or unusable.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| normalize_at_width | INT | 0 | If greater than 0, it will resize all images to this width, requiring normalize_at_height to be set, by default normalization is otherwise done at the image with most megapixels |
| normalize_at_height | INT | 0 | If greater than 0, it will resize all images to this height, requiring normalize_at_width to be set, by default normalization is otherwise done at the image with most megapixels |
| normalize_upscale_method | COMBO | nearest-exact | The method to use when upscaling images |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| NORMALIZER | AIHUB_NORMALIZER | — |