Nodes/ComfyUI-ImageAutosize/Apply Autosize Transform
ComfyUI Node

Apply Autosize Transform

Keep your mask glued to your image — replay one autosize onto everything

By SparknightLLC·Created about a year ago·Updated about a month ago· 0
Apply Autosize Transform
  • image
  • transform
  • resized
interpolation_modenearest-exact

If your inpaint masks keep coming out a couple of pixels off from the image, this is the node that fixes it. Apply Autosize Transform is the middle of ComfyUI-ImageAutosize's little three-node family: the main Image/Mask Autosize decides the geometry, this node replays it on a second asset, and Restore Autosized Image/Mask reverses it after diffusion. On its own it looks like a boring one-in-one-out pass-through - image in, image out - which is exactly why beginners skip it and then wonder why things drift.

The problem is real. Every time you resize a base image for diffusion you also need the inpaint mask, the depth map, or the ControlNet image resized the same way. Do them as two independent resize nodes and the rounding, anchored crop, and divisible-by rounding will quietly disagree by a few pixels. A mask that's two pixels off turns a clean edit into a blurred seam. Mask-based inpainting's whole remaining superpower is bit-identical unmasked pixels; alignment is what buys you that.

How it works: the main Image/Mask Autosize node records its full geometry - original size, resize size, target size, crop offset, and crop mode - and exposes it on its transform output. Apply Autosize Transform takes that transform plus any image or mask and replays the exact resize-and-crop the main node did. The source code checks your input's dimensions against the transform's original_width/original_height and raises a ValueError if they don't match, so it refuses to silently misalign. It accepts IMAGE or MASK and returns the same type you fed it.

The inputs that matter:

  • image - the asset you want aligned (image or mask).
  • transform - wire this from the Image/Mask Autosize output of the same run.
  • interpolation_mode - default nearest-exact, and keep it for masks: nearest preserves hard edges. If you're replaying onto a photo, switch to bilinear or lanczos to match the main node.

The only output is resized, which plugs straight into your inpaint/ControlNet/VaeEncode. The stock setup is one Image/Mask Autosize feeding two of these nodes - one for the photo, one for the mask - and both come out pixel-identical in size.

Install: grab the pack via ComfyUI Manager (search "ComfyUI-ImageAutosize") or:

cd ComfyUI/custom_nodes
git clone https://github.com/SparknightLLC/ComfyUI-ImageAutosize.git

Then restart ComfyUI. No model downloads, no third-party Python dependencies - the pack leans on ComfyUI's own shared resize implementation. One requirement: a recent ComfyUI build with the V3 MatchType node API, so don't try this on a year-old install. It's a new node even for this new pack (added in v0.3.0, August 2026), so if you've had the pack a while, update.

The one trap to know: the transform is only valid for the source image it was computed from. Feed this node anything resized differently and it errors out - which is honest, if unhelpfully named. Wire the transform from the Image/Mask Autosize run that produced your base image and you'll never hit it.

Categoryimage

Inputs (3)

NameTypeDefaultDescription
imageCOMFY_MATCHTYPE_V3
transformAUTOSIZE_TRANSFORM
interpolation_modeCOMBOnearest-exact5 options: nearest-exact, bilinear, area, bicubic, lanczos

Outputs (1)

NameTypeDescription
resizedCOMFY_MATCHTYPE_V3