Nodes/ComfyUI-CN-Pre/Resize for ControlNet
ComfyUI Node

Resize for ControlNet

Resize — matching your control map to your generation dimensions

By OKIE5·Created 10 months ago·Updated 10 months ago· 0
Resize for ControlNet
  • image
  • control_image
height512
width512
snap_to_x8

A control image that doesn't match the dimensions of the latent you're sampling is one of the most common, most avoidable ways a ControlNet workflow breaks. Your source photo is whatever resolution it happens to be; your generation is whatever resolution you set it to. This node exists to close that gap deliberately, right in the graph, instead of hoping your preprocessor's output happens to line up.

The one setting that actually matters

height and width (both defaulting to 512, step 8) are exactly what they sound like - the target dimensions to resize your control image to. Set these to match your actual generation resolution, not your source image's native size. snap_to_x8 is the setting worth understanding rather than ignoring: Stable Diffusion and SDXL's VAE downsamples images by a factor of 8 on each side to get to latent space, which is why dimensions divisible by 8 are the baseline requirement almost everywhere in this ecosystem - pick a height or width that isn't a clean multiple of 8 and you risk a hard error or a silent crop further downstream. snap_to_x8 rounds whatever you typed to the nearest multiple of 8 automatically, so it's cheap insurance against that specific mistake. Worth knowing if you're on Flux specifically: Flux wants dimensions divisible by 64, not just 8, so an 8-aligned control image isn't automatically guaranteed to be Flux-safe - check your actual generation size against 64 as well if you're on that architecture.

Inputs and outputs

Required: image, height, width, snap_to_x8. No optional inputs, no model passthrough - this is a pure resize utility, not a Loaders node. Output: control_image (IMAGE), sized to your target dimensions and ready to feed into your ControlNet Apply node.

Where it fits

Drop it wherever your control image and your generation dimensions might not already agree - most commonly right after a preprocessor (any of this pack's CN-Pre-Loaders nodes, or a preprocessor from a different pack entirely) and before your ControlNet Apply node. If your source image and your target generation size already match, you don't strictly need this node at all - but it costs nothing to have it in the graph as a safety net, since a workflow you build today at one resolution might get reused at a different one tomorrow.

Installing it

Search ComfyUI-CN-Pre in ComfyUI Manager, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/OKIE5/ComfyUI-CN-Pre, then restart. As with the rest of this pack, don't expect much from the README - it's a one-line stub unrelated to what the pack actually does, so there's no dedicated documentation for individual nodes like this one. That's less of a concern here than elsewhere in the pack, though: this node has no external dependencies and no model weights to hunt down, so there's genuinely nothing to get wrong beyond the numbers you type in.

Where people get burned

The failure mode this node exists to prevent is exactly the one people hit without it: a control image at one resolution, a latent being sampled at another, and either a dimension-mismatch error or - worse - a silent misalignment where the ControlNet appears to run but the spatial structure doesn't actually correspond correctly to what's being generated. If your ControlNet output looks subtly "off" in a way that's hard to pin down, checking that your control image's actual pixel dimensions match your generation size is a cheap, easy first diagnostic step, and this node is the fix once you find the mismatch. Beyond that, remember snap_to_x8 handles the 8-divisibility requirement most architectures need, but it won't save you on Flux's stricter 64-divisibility rule - you'll need to pick your target height/width with that in mind up front if that's your base model.

CategoryCtrlNet/Pre

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
heightINT51264–2048
widthINT51264–2048
snap_to_x8COMBO2 options: true, false

Outputs (1)

NameTypeDescription
control_imageIMAGE