ImageCropMultEight
A crop that won't blow up your latent space
- image
- IMAGE
The fastest way to kill a ComfyUI run is a random crop. You isolate a region, VAE-encode it, and the graph dies on a shape mismatch - because the VAE downsamples by 8 and your crop was 317 pixels wide. ImageCropMultEight exists so you never think about that again: it crops the box you want and quietly rounds the dimensions down to the nearest multiple of 8 first.
The inputs that matter are few:
width/height(INT, default 256, step 8) - how big a box. The spinner moves in steps of 8, and the node enforces the rule even if you type a wonky number: ask for 300 and you get 296, since subtracting the remainder is safer than inventing pixels you don't have.position- a 3×3 anchor grid: top-left, top-center, top-right, right-center, bottom-right, bottom-center, bottom-left, left-center, center.x_offset/y_offset- nudge the box after anchoring. The range goes down to -99999, so effectively "as much as you need."
One IMAGE out, ready to drop into a VAE encode, a ControlNet condition, or an img2img pass.
Mechanically it's boring in the best way: pick the anchor, apply the offsets, slice the tensor, clamp to the image edges. Two quirks are worth knowing so they don't read as bugs. First, it clamps rather than errors - if your box pokes past the right or bottom edge, the crop just shrinks to what fits. So a crop can come out smaller than you asked for. That's the guard working. Second, the mult-of-8 rounding only ever shrinks; you can't exceed the source.
Why you'd reach for it: any time you crop to feed a sub-step. Crop a face and run it through a face-restore or detail pass, then composite it back. Crop a region to feed a ControlNet. Crop a tile for a tiled-upscale run. Because the output is guaranteed divisible by 8, it plugs straight into latent-space operations that would refuse an arbitrary crop. Core ComfyUI's ImageCrop will happily hand you 317px and let you discover the problem a few nodes later; this node refuses to set the trap.
Install is the pack-standard route. ComfyUI Manager → search "ImgProcessing_ComfyUI" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/nirbhay-faaya/ImgProcessing_ComfyUI
# restart ComfyUI
No models, no requirements.txt. The only hard dependency is opencv-python, imported at the top of the pack's single file - missing cv2 and the whole pack (all four nodes) fails to load. If you don't see the node, pip install opencv-python into your ComfyUI venv and restart before blaming anything else.
The pack is a lone commit from May 2024, unmaintained since - for a pure tensor-slice node that means it just keeps working. Honest verdict: if you never crop mid-workflow, skip it. If you do, it's the difference between a "why is this failing now" moment and a graph that runs.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 2560–8192 | — |
| height | INT | 2560–8192 | — |
| position | COMBO | 9 options: top-left, top-center, top-right, right-center, bottom-right, bottom-center, +3 | |
| x_offset | INT | 0 | — |
| y_offset | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |