Nodes/image_control/abyz22_Padding Image
ComfyUI Node

abyz22_Padding Image

Zoom-and-pad data augmentation with pose baked in

By abyz22·Created 3 years ago·Updated 2 years ago· 17
abyz22_Padding Image
  • image
  • conditioning
  • vae
  • image
  • pose_image
  • conditioning
  • latent
control_net_name
pose_strength1.00
pad_mode
mode_type
Ratio_min0.5
Ratio_max1.5
seed0

This is the pack's "Resize Image (zoom in/out)" node, and it does a lot more than the name suggests. You hand it an image, a conditioning, a VAE, and a ControlNet; it resizes your image by a random factor between two ratios, pads (or crops) it back to the original canvas, computes the pose of whatever's in the frame, and hands back the padded image, the pose skeleton, a conditioning with that pose ControlNet already applied, and the latent. One queue roll and you get a "zoomed differently" variant with the pose conditioning kept honest.

It's from abyz22/image_control, the Impact Pack fork. In that world the pattern is obvious - "Change Breast," "Resize Head," "Showing only 1 breast" all want the subject re-framed without the body breaking - but as a pure data-augmentation tool it's also solid for training sets, which is exactly what the random zoom/pad/placement variety is for.

Inputs that matter

  • image, conditioning, vae - the usual trio.
  • control_net_name - picked from your models/controlnet folder; openpose works best since the node generates a pose image.
  • pose_strength (0–10, default 1) - ControlNet weight on the applied pose.
  • pad_mode - constant (solid border), replicate (stretch edge pixels), or noise (random static in the padding).
  • mode_type - where the resized image sits: Top-Left through Center to Bottom-Right, or Random per frame.
  • Ratio_min/Ratio_max (0.3–2.5) - the random zoom factor range. Below 1 zooms out (pads), above 1 zooms in (crops).
  • seed - drives the placement/zoom roll.

Outputs: image, pose_image, conditioning (with ControlNet applied), latent - everything downstream needs in one shot.

How it works

It resizes per frame by a random ratio, places the result on the canvas per mode_type, and fills the leftover with your pad_mode. It detects pose through DWPreprocessor (from ComfyUI's ControlNet Aux Preprocessors - that pack must be installed or this node fails), resizes the pose skeleton to match, then loads the ControlNet and applies it to your conditioning with pose_strength. Finally it VAE-encodes to latent. The careful bit: when Ratio_min and Ratio_max are both ~1, it skips the whole dance and just encodes - a nice passthrough that keeps the node safe in non-augmentation pipelines.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/abyz22/image_control

or ComfyUI Manager → "image_control", restart, and install ComfyUI ControlNet Aux Preprocessors alongside. Pack requirements add openpyxl, pytorch-lightning, kornia.

Where it bites

The DWPreprocessor dependency is the big one - if the node dies with a missing-mapping error, install ControlNet Aux. Watch the canvas math: Ratio_max above ~2 with a mode_type near the edges can crop so much of the subject out that the pose ControlNet fights the composition. And because the zoom factor is random per frame, batch output is deliberately inconsistent - that's the point for augmentation, but don't expect frame-to-frame continuity if you're trying to use it for something steady.

Categoryabyz22

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
conditioningCONDITIONING
vaeVAE
control_net_nameCOMBO0 options:
pose_strengthFLOAT1.000–10
pad_modeCOMBO3 options: constant, replicate, noise
mode_typeCOMBO10 options: Top-Left, Top, Top-Right, Center-Left, Center, Center-Right, +4
Ratio_minFLOAT0.50.3–2.5
Ratio_maxFLOAT1.50.3–2.5
seedINT00–18446744073709550000

Outputs (4)

NameTypeDescription
imageIMAGE
pose_imageIMAGE
conditioningCONDITIONING
latentLATENT