Nodes/ComfyUI-iTools/Crop Image (Beta)
ComfyUI Node

Crop Image (Beta)

Interactive cropping with aspect-ratio and grid snapping

By MohammadAboulEla·Created 2 years ago·Updated 7 days ago· 236
Crop Image (Beta)
    • image
    resize_rulegrid
    grid_step64
    image

    An interactive crop tool that lives directly in the node - upload or connect an image, drag a crop region on the canvas, and get back just that region. The two things that separate it from just eyeballing a crop with a Mask node are the aspect-ratio presets and the grid snapping, both aimed at the same real problem: getting crop dimensions that don't fight your model later.

    How it works

    resize_rule controls how the crop region is constrained while you're dragging it. free means exactly that - no constraint, drag whatever rectangle you want. grid (the default) snaps the crop's edges to multiples of grid_step pixels rather than letting you land on an arbitrary size. The rest of the options are fixed aspect ratios - 1:1, 16:9, 9:16, 3:2, 4:3, 2:3, 3:4, 4:5, 5:4, 9:21 and a couple more - so if you know you need a square thumbnail or a portrait-orientation crop for a specific platform, the tool holds that ratio for you while you drag instead of you eyeballing it.

    The grid-snap default matters more than it looks like it should: grid_step defaults to 64, and diffusion models are generally much happier with width/height divisible by 8 (many pipelines effectively want 64 to stay clean through VAE and latent-space operations). Cropping freely and then feeding an odd 837×612 region into a sampler is a common source of the "dimensions must be divisible by 8" class of error - snapping to a 64px grid while you crop sidesteps that before it happens.

    The inputs and outputs that matter

    • resize_rule - free, grid (default), or one of eleven fixed ratios.
    • grid_step - 1 to 128, default 64. Only relevant when resize_rule is set to grid.
    • image - the standard ComfyUI image widget: upload a file, or pick one already sitting in your input folder.

    Output is a single cropped image.

    Installing it

    Via ComfyUI Manager: search "iTools" or "ComfyUI-iTools," install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MohammadAboulEla/ComfyUI-iTools
    

    then restart.

    Troubleshooting

    The node is marked Beta and you're worried about relying on it. That label is the author's own, and it's paired with a broader note in the README: this is one of four nodes in the pack (alongside Prompt Record, Image Preview, and Image Compare) not yet compatible with ComfyUI's newer Node 2.0 (Beta) frontend. If cropping doesn't render right, or the drag handles don't respond, switch back to the classic node system rather than assuming the node is simply broken.

    Crop dimensions still don't divide evenly by 8. Confirm resize_rule is actually set to grid and not free - it's easy to leave it on free while testing and forget to switch back before your final crop. Also check grid_step: it defaults to 64, but if you've turned it down, the resulting crop will be a smaller multiple that might not be divisible by 8 depending on the value you chose.

    A fixed aspect ratio isn't landing exactly where you want it on the image. These ratio presets constrain the shape of the crop rectangle, not its position - you still drag to place it. If the constrained shape doesn't fit your source image well (a 9:16 crop on a wide landscape photo, for instance), you'll be working with a narrow strip no matter how you position it; that's the geometry, not a bug.

    CategoryiTools

    Inputs (3)

    NameTypeDefaultDescription
    resize_ruleCOMBOgrid13 options: free, grid, 1:1, 2:3, 3:4, 4:5, +7
    grid_stepINT641–128
    imageCOMBO1 options: example.png

    Outputs (1)

    NameTypeDescription
    imageIMAGE