Batch Crop Image (Mikey)
Trim an edge percentage off an entire folder at once
- image
If you've ever scraped or downloaded a folder of images that all share the same annoying border - a watermark strip, letterboxing, a UI chrome sliver from a screenshot tool - you know the tedious part isn't figuring out the crop, it's doing it to every single file by hand. Batch Crop Image points at a directory and shaves a percentage off the edges of every image in it in one pass, then hands you back the whole set as a list, ready to feed into whatever comes next in your graph.
This is a genuinely useful prep step before dataset work - cleaning up a folder of reference images before captioning them for LoRA training, or before batch-resizing them for a consistent training set. It's also just handy any time you have a pile of images that all need the identical crop and you don't want to open an editor twenty-plus times.
The inputs that matter: image_directory is a plain string path to the folder - point it at wherever your source images live. crop_amount is a float, default 0.05 (5%), controlling how much gets trimmed off. The output is image, but note it's flagged is_list - meaning ComfyUI treats this as a batch of separate images rather than one combined tensor, so anything downstream that expects a single image will instead run once per file in the folder, which is usually what you want for this kind of bulk operation but worth knowing if a downstream node behaves unexpectedly.
Installing it
Comes with the full Mikey Nodes pack. Through ComfyUI Manager, search "Mikey Nodes." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/bash-j/mikey_nodes
Restart ComfyUI. No models or extra dependencies needed - this is plain filesystem and image-cropping work.
Common issues
The README is blunt about the real risk here, in the context of the pack's related batch-resize node, and it applies just as much to this one: be careful with folders that have a lot of images in them. Because the output is a full list that ComfyUI will process, pointing this at a folder with hundreds or thousands of files can eat a large amount of memory and time in one go - test on a small subfolder first before running it against your real dataset.
The other common trip-up is path formatting - image_directory is a raw string, so Windows-style backslashes versus Linux-style forward slashes matter depending on your OS, and a path that looks right but has a typo or a trailing slash issue will fail rather than silently doing nothing. Double-check the path exists and is spelled exactly right before assuming the node itself is broken.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_directory | STRING | — | |
| crop_amount | FLOAT | 0.05 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |