Focal Rescale
Crop to fit without slicing the subject in half
- image_in
- IMAGE
- rect_left
- rect_top
- rect_width
- rect_height
Focal Rescale is the flagship node of this pack, and the reason the pack exists at all. It changes an image's aspect ratio by cropping around a point you choose - so the thing you care about survives the crop, and the result is resized to your target width and height without being squashed or stretched.
The author's own origin story: he was tweaking img2img workflows and wanted to turn any source image into a 16:9 diffusion canvas without building a tangle of math nodes, so he wrote this and posted it to r/comfyui. The README's classic example says it all: a moon sitting at pixel (600,100) in a big source image, rescaled to 800x200 and 512x768 - the moon stays in frame in both, because the crop was built around it rather than around the image's center.
How it works
The mechanism, from the code rather than the docs: you give it a target width and height. It computes the target aspect ratio, then finds the largest rectangle with that ratio that fits entirely inside the source image. That rectangle is centered on your focal point; if centering would shove an edge outside the image, the rectangle is clamped back in. Then it crops that rectangle and resizes it to exactly the target size.
That's the whole cleverness: it takes the maximum rectangle from the source, not just whatever fits around the focal point, so you keep the most image area possible. And it's all plain PIL pixel math - no diffusion, no models, nothing to download.
The inputs that matter
width/height- your output canvas, 16 to 2048.focalx/focaly- the point in the source image's pixel coordinates you want centered. The defaults are 256,256, which is top-left-ish on most images: change them. If you'd rather not hand-pick them, that's exactly what the pack's Focalpoint from SEGS node is for - feed it a face detection and wire its X/Y straight in.
Outputs: the resized IMAGE, plus rect_left / rect_top / rect_width / rect_height - the crop rectangle in source coordinates. Those matter more than they look: if you're cropping a matching mask or depth map with the same geometry, you can feed the same four numbers into another crop and keep everything aligned.
Where it fits
It's the "crop" half of the detect-crop-refine loop from the Impact Pack world (the same one masking-detection-detailing.md describes) - without a detailer attached. Pair it with a face detector and you get automatic framing for a detail pass or an img2img regeneration.
Gotchas, learned the hard way
This node is built for single images. The multi-image batch path in this pack's crop nodes is not something to trust - feed one image at a time, or loop over your batch yourself. And keep expectations honest: it's a plain PIL resize, fine for pre- and post-processing, not a detail-adding upscaler. If your crop keeps landing wrong, suspect the focal point before the node - with the rectangle clamped to the image bounds, an extreme focal point just silently degrades into an edge crop.
Installing it
The pack has zero extra dependencies - pure PIL/numpy/torch, already in ComfyUI. ComfyUI Manager: search for Comfy_Felsirnodes (or "Felsir"), install, restart. Manual: cd ComfyUI/custom_nodes then git clone https://github.com/Felsir/Comfy_Felsirnodes, restart. The node lives under Add Node → Felsir.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image_in | IMAGE | — | |
| width | INT | 51216–2048 | — |
| height | INT | 51216–2048 | — |
| focalx | INT | 256 | — |
| focaly | INT | 256 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| rect_left | INT | — |
| rect_top | INT | — |
| rect_width | INT | — |
| rect_height | INT | — |