Image Resize WAN Adaptive Framing
One node to prep images for WAN video
- image
- resized_image
- debug_image
- width
- height
- selected_preset
Image-to-video with Wan (2.1/2.2, the local video workhorse) has two silent killers: a start frame at the wrong resolution, and a subject framed so badly that the model invents or mangles it the moment motion starts. Image Resize WAN Adaptive Framing handles both in one pass. It auto-selects a Wan-friendly resolution, detects faces and bodies, and applies subject-aware framing via crop or soft-bar padding before you ever hit the video model. You drop a source image in, get a properly prepped start frame out, plus the exact width/height and the preset it chose.
This is a "prepare, don't guess" node for the Wan I2V pipeline. The pack also ships Wan LoRA-by-text loaders for the same workflow, so this is clearly the author's own image-to-video prep ritual, packaged.
How it works
Three stages, each grounded in real choices:
Resolution selection. Wan presets in three tiers - small (416×240), main (832×480), high (1280×720) - with vertical variants derived by transposing. resolution_tier defaults to auto, which picks the tier closest to your source's area, and orientation_mode (auto/force_horizontal/force_vertical) decides the orientation. This keeps you on the resolutions Wan was trained on instead of random multiples.
Subject detection. The clever bit: it uses OpenCV Haar (faces) + HOG (people) detectors - lightweight CPU methods, deliberately not a deep model, per the source notes - so no VRAM and no checkpoint download. framing_mode defaults to auto_subject: face first, body if no face, center if neither. The detection dials (face_min_percent, detect_scale_factor, detect_min_neighbors) match the pack's face-crop node.
Framing. anchor_strength (0.85) and top_bias (0.18) position the anchor, then resize_mode applies it as crop (content-preserving crop to the preset) or pad (fit within the preset with soft bars). upscale_method (default lanczos) picks the interpolator.
Outputs: resized_image, debug_image (an overlay showing detected faces/bodies and the crop box - default on, disable with emit_debug_image), plus width, height, and selected_preset strings/ints so downstream nodes know exactly what you're working with. Those metadata outputs are the difference between this and a blind resize - wire them to a text node or your filename to see the decision.
Installing it
Part of CorvaeOboro's ComfyUI_illumorae (CC0 - no model downloads; the Haar/HOG detectors ship inside OpenCV). ComfyUI Manager → search illumorae, or:
cd ComfyUI/custom_nodes
git clone https://github.com/CorvaeOboro/ComfyUI_illumorae
Common issues
- Subjects ignored / face not found - Haar wants frontal faces. In
auto_subjectit falls back to body (HOG), then center; if a subject still gets cropped, checkdebug_imageto see what was detected, and lowerface_min_percent/min_neighbors. - Wanted horizontal, got vertical (or vice versa) -
orientation_modeisautoby default, so it follows the source. If your pipeline needs a fixed orientation regardless of input, force it. padbars look wrong - soft bars are matte-colored padding by design; if you want true letterboxing with a specific color, the pack's Image Resize w Matte gives you explicit matte control instead.- Video looks off anyway - the node preps the frame, but Wan 2.2 motion/quality still depends on your sampler and LoRAs. Treat this as removing a failure mode, not guaranteeing results.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| orientation_mode | COMBO | auto | 3 options: auto, force_horizontal, force_vertical |
| framing_mode | COMBO | auto_subject | 4 options: auto_subject, human_face, human_body, center |
| resize_mode | COMBO | crop | 2 options: crop, pad |
| resolution_tier | COMBO | auto | 4 options: auto, small, main, high |
| upscale_method | COMBO | lanczos | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
| anchor_strength | FLOAT | 0.850–1 | — |
| top_bias | FLOAT | 0.18-0.5–0.5 | — |
| face_min_percent | FLOAT | 3.00.5–40 | — |
| detect_scale_factor | FLOAT | 1.101.01–1.5 | — |
| detect_min_neighbors | INT | 51–12 | — |
| debug_printsopt | BOOLEAN | false | — |
| emit_debug_imageopt | BOOLEAN | true | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| resized_image | IMAGE | — |
| debug_image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| selected_preset | STRING | — |