Boyo Image Crop
Tile-crop a huge image into training patches without leaving ComfyUI
- image
- status
Boyo Image Crop is the node you reach for when a source image is too big to feed anywhere useful and you need it chopped into pieces: building a tiled dataset for training or ControlNet preprocessing, preparing high-res crops for an upscaler, or just slicing reference material into patches you can shuffle later. Feed it an image, tell it the patch size and overlap, and it writes PNG crops straight to disk.
It's a save-to-disk tool, not a "give me crops back in the graph" tool - the only output is a status string telling you how many crops it wrote. That's fine for its job. You run it once, watch output/crops/crop_001.png climb into the hundreds, and point your next loader at the folder.
How it works
Mechanically it's simple and transparent. Step size is crop_size − overlap, so it walks the image like a sliding window: a 4096×4096 image with 1024 crops and 128 overlap yields crops starting at x=0, x=896, x=1792… The overlap exists so patches share context at their edges - essential if you're later stitching tiles back together or training on crops that need continuity across tile borders.
The inputs that matter
- crop_width / crop_height - patch size, defaults 1024, step 64. Match these to what your model or training config actually accepts.
- overlap - shared pixels between adjacent patches, default 128, step 32. The larger the overlap, the more redundancy (and the more crops).
- output_path - destination folder relative to ComfyUI's
output/directory, defaultcrops. - image - an IMAGE tensor. If you hand it a batch, it only crops the first frame, so don't expect batch support.
Output: status, a STRING like "Target image = 12 crops". Nothing else - no image output.
Install
Part of Boyonodes. ComfyUI Manager → search "Boyonodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
Restart. No extra pip packages; it's plain PIL + torch.
Gotchas
Two things will bite you. First, the image must be at least as large as the crop size - a 512×512 source with 1024 crops just returns an error string. Second, keep overlap below the crop size; since the step is crop_size − overlap, an overlap that meets or exceeds the crop size gives you a zero or negative step and the grid logic goes nowhere. The defaults are sane; don't get clever unless you know what you're doing. And remember, it only ever writes to disk and only ever reads the first frame - for batch tiling you'd run it per image.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| crop_width | INT | 102464–4096 | — |
| crop_height | INT | 102464–4096 | — |
| overlap | INT | 1280–512 | — |
| output_path | STRING | crops | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| status | STRING | — |