Extensions/H3-image-prep
ComfyUI Extension

H3-image-prep

ComfyUI custom node to help resize photos for Minimax H3 I2V input

By artvandelay18160·Created 16 days ago·Updated 16 days ago· 1
artvandelay18160/H3-image-prep
Nodes1
On cloudLocal install
Categoryimage/preprocessing
Stars1
Updated16 days ago
Readme

MiniMax H3 Image Prep

H3 Aligned Image Resize prepares ComfyUI IMAGE tensors for MiniMax H3-style workflows. It picks dimensions from the source aspect ratio, sets the short edge to any requested multiple of 32, and rounds the long edge to the nearest selected alignment multiple (32 by default).

Installation

Place this folder in ComfyUI/custom_nodes/, then restart ComfyUI. The node appears under image/preprocessing.

Inputs and outputs

  • image: a ComfyUI IMAGE batch ([B, H, W, C]).
  • short_edge: any positive multiple of 32; 512 is the default.
  • alignment: long-edge rounding multiple; 32 is the default.
  • resize_mode: crop (default), pad, or stretch.
  • anchor: placement for crop and pad. center is the default; edges and corners are available.
  • resampling: lanczos, bicubic, bilinear, or nearest.

The outputs are the processed IMAGE, target width, target height, and target aspect ratio.

Resize modes

  • crop preserves aspect ratio, crops to the target aspect ratio at the chosen anchor, then resizes.
  • pad preserves the full image, fits it within the target canvas at the chosen anchor, and adds black padding on the remaining side or sides.
  • stretch resizes directly to the target dimensions and may distort the image.

Dimension selection

For landscape and square sources, the selected short edge becomes the height; for portrait sources, it becomes the width. The long edge is calculated from the original aspect ratio and rounded to the nearest alignment multiple. Exact half-way cases round upward. Both output dimensions are exact.

Examples: 2368x1792 becomes 672x512 at short edge 512 and 1024x768 at short edge 768. The same logic accepts sizes such as 320, 448, 640, 896, or 1024.

| Source AR | 512 short edge | 768 short edge | |---|---:|---:| | 1:1 | 512x512 | 768x768 | | 3:2 | 768x512 | 1152x768 | | 2:3 | 512x768 | 768x1152 | | 4:3 | 672x512 | 1024x768 | | 3:4 | 512x672 | 768x1024 | | 5:4 | 640x512 | 960x768 | | 4:5 | 512x640 | 768x960 |