Nodes/ComfyUI illumorae/Image Resize WAN Adaptive Framing
ComfyUI Node

Image Resize WAN Adaptive Framing

One node to prep images for WAN video

By CorvaeOboro·Created 8 months ago·Updated 6 days ago· 1
Image Resize WAN Adaptive Framing
  • image
  • resized_image
  • debug_image
  • width
  • height
  • selected_preset
orientation_modeauto
framing_modeauto_subject
resize_modecrop
resolution_tierauto
upscale_methodlanczos
anchor_strength0.85
top_bias0.18
face_min_percent3.0
detect_scale_factor1.10
detect_min_neighbors5
debug_printsfalse
emit_debug_imagetrue

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_subject it falls back to body (HOG), then center; if a subject still gets cropped, check debug_image to see what was detected, and lower face_min_percent/min_neighbors.
  • Wanted horizontal, got vertical (or vice versa) - orientation_mode is auto by default, so it follows the source. If your pipeline needs a fixed orientation regardless of input, force it.
  • pad bars 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.
Categoryillumorae

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
orientation_modeCOMBOauto3 options: auto, force_horizontal, force_vertical
framing_modeCOMBOauto_subject4 options: auto_subject, human_face, human_body, center
resize_modeCOMBOcrop2 options: crop, pad
resolution_tierCOMBOauto4 options: auto, small, main, high
upscale_methodCOMBOlanczos5 options: nearest-exact, bilinear, area, bicubic, lanczos
anchor_strengthFLOAT0.850–1
top_biasFLOAT0.18-0.5–0.5
face_min_percentFLOAT3.00.5–40
detect_scale_factorFLOAT1.101.01–1.5
detect_min_neighborsINT51–12
debug_printsoptBOOLEANfalse
emit_debug_imageoptBOOLEANtrue

Outputs (5)

NameTypeDescription
resized_imageIMAGE
debug_imageIMAGE
widthINT
heightINT
selected_presetSTRING