Nodes/ComfyUI-Inference-Core-Nodes/[Inference.Core] Enchance And Resize Hint Images
ComfyUI Node

[Inference.Core] Enchance And Resize Hint Images

The Node That Stops ControlNet Shape Mismatches

By LykosAI·Created 2 years ago·Updated about a year ago· 33
[Inference.Core] Enchance And Resize Hint Images
  • hint_image
  • IMAGE
image_gen_width512
image_gen_height512
resize_modeJust Resize

Every ControlNet workflow has a boring but non-negotiable requirement hiding underneath it: your condition image and your generation's latent need to line up dimensionally, or things get weird - misalignment at best, a hard shape-mismatch error at worst. It's the kind of problem you don't notice until you drop a differently-sized reference photo into a workflow that was built and tested against a specific resolution, and suddenly your conditioning doesn't match your output. This node is the fix, and it's pure plumbing - no detection, no model, just careful resizing.

It takes whatever "hint" image you've built (the output of any of the preprocessors elsewhere in this pack - Canny, Lineart, Tile, whatever) and resizes it to exactly match your intended generation dimensions, using one of three strategies that will look immediately familiar if you've ever used A1111's ControlNet extension, because they're the same three modes: "Just Resize" stretches the image to fit, ignoring aspect ratio - fast and simple, but distorts anything that doesn't already match your target ratio. "Crop and Resize" crops the source to match the target aspect ratio first, then resizes - no distortion, but you lose whatever fell outside the crop. "Resize and Fill" fits the whole source inside the target dimensions and pads the leftover space - nothing gets cropped or stretched, but you get letterboxing.

What you set: hint_image is required - this is your preprocessed condition image, not the raw source photo. image_gen_width and image_gen_height (both default 512, range 64–8192, step 8) are your actual target generation dimensions - set these to match whatever you're feeding Empty Latent Image or your KSampler, not the hint image's original size. resize_mode (default "Just Resize") is the one decision that actually matters here: pick "Crop and Resize" when your source and target aspect ratios differ and distortion would hurt (faces, architecture, anything with recognizable proportions), or "Resize and Fill" when you'd rather keep the whole source intact and accept some padding. The single IMAGE output is the resized hint, ready to feed directly into your ControlNet Apply node.

The practical habit worth building: put this node right before ControlNet Apply, every time, rather than only reaching for it when something breaks. Preprocessor outputs default to their own resolution parameter (usually 512), which frequently doesn't match your actual target generation size - this node is what closes that gap without you having to manually resize images outside ComfyUI first.

Installing it: bundled in LykosAI's ComfyUI-Inference-Core-Nodes - LykosAI also makes Stability Matrix, the meta-installer a lot of people use to manage local SD UIs, so this pack's install path is more deliberate than a typical solo repo. Search "ComfyUI-Inference-Core-Nodes" in ComfyUI Manager, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes, then run install.py against ComfyUI's own Python environment, or pip install -e .[cuda] / .[cuda12] / .[rocm] / .[directml] / .[cpu] matched to your hardware, or a plain pip install -e . without acceleration extras - this node is pure resizing logic and doesn't need onnxruntime at all. Restart ComfyUI when done.

Troubleshooting: the pack-wide issue people actually hit is ModuleNotFoundError: No module named 'inference_core_nodes' after a git clone, meaning the Python package install step didn't finish - usually install.py running against the wrong interpreter on a portable ComfyUI build, so target python_embeded explicitly there. For this node specifically, if your condition still looks misaligned after using it, double-check image_gen_width/image_gen_height actually match what's going into your KSampler - a mismatch there defeats the whole point of the node, and it's an easy thing to leave stale after changing your generation resolution elsewhere in the graph.

CategoryControlNet Preprocessors

Inputs (4)

NameTypeDefaultDescription
hint_imageIMAGE
image_gen_widthINT51264–8192
image_gen_heightINT51264–8192
resize_modeCOMBOJust Resize3 options: Just Resize, Crop and Resize, Resize and Fill

Outputs (1)

NameTypeDescription
IMAGEIMAGE