Nodes/Illustrious LoRA Tools/Illustrious Interactive Dataset Crop
ComfyUI Node

Illustrious Interactive Dataset Crop

A real crop editor inside your node graph, bound by image hash

By katorikonoe-ai·Created 17 days ago·Updated 3 days ago· 0
Illustrious Interactive Dataset Crop
  • dataset
  • dataset
  • crop_report
crop_plan_json{}

Most dataset prep is done in a file manager: open image, draw box, save, repeat sixty times. IllustriousDatasetCrop moves that into ComfyUI, and it's the only node in this pack with a genuine interactive UI - you click Open interactive crop editor on the node, page through your prepared images, drag rectangles, hit save, then queue the graph to apply them.

It also does something file managers can't: every crop is bound to a SHA-256 of the source image. Change the source and the stale crop is refused instead of silently applied to the wrong picture.

Two halves, one node

The editor is a small browser extension shipped in the pack's web/ directory, talking to two read-only HTTP routes declared in crop_routes.py: one that lists the images in a run, one that serves a JPEG thumbnail of a specific image along with an X-Source-SHA256 header. That header is where the hash comes from. Install the Python and skip web/ and crop_routes.py and you get a node with no editor button.

The node itself is the apply step. It takes dataset and crop_plan_json, validates the plan, and then - if it's non-empty - copies the run into a fresh one labelled cropped, crops each planned image, updates the new manifest's width and height for every cropped file, records parent_run and the plan, and hands you the new handle. An empty plan ({}) returns NO_CROPS and leaves your dataset alone, so leaving the node in the graph while you're not cropping is harmless.

Validation before any pixel is touched: the plan has to reference files that exist in the run, each entry has to be exactly {box, sha256}, box has to be four finite numbers forming 0 ≤ x0 < x1 ≤ 1 and 0 ≤ y0 < y1 ≤ 1, the hash has to match the current image, and a crop has to leave at least 16 pixels a side. Normalised coordinates make the plan resolution-independent, but the hash check means it won't survive the picture being different.

The fields

dataset in, and crop_plan_json - a multiline string holding the JSON the editor produced. You don't hand-author it. If you want to reuse crops from the pack's crop-review workflow in the full-training workflow, you copy this string across and point both at the same original source.

Out comes dataset (the cropped copy, or your input if the plan was empty) and crop_report, JSON with a status of CROPPED_COPY, NO_CROPS, or crop_failed, plus the source run and the new run names and how many images were edited.

Crop aspect ratio is free. You don't have to hit 1024×1024 here - the trainer's aspect bucketing is what deals with odd shapes, and it picks the closest bucket by log aspect ratio, center-cropping the residual mismatch. Choosing the crop is choosing how the trainer will frame your subject, and the bucketing won't rescue a sloppy one.

Install

Manager, searching ComfyUI-IllustriousLoRATools (shown as Illustrious LoRA Tools), or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/katorikonoe-ai/ComfyUI-IllustriousLoRATools
pip install -r ComfyUI-IllustriousLoRATools/requirements.txt

Requirements go into ComfyUI's Python so the host CUDA PyTorch build stays intact. The editor is JavaScript served by the pack itself, so restart the server and hard-refresh the browser after installing or updating - a stale cached script is the usual reason a node update looks like it did nothing.

You can also run the pack's 00_Advanced_Crop_Review_v1.2.0.json example on its own. It needs no model and no GPU: prepare a folder or ZIP from ComfyUI/input, queue once, click into the editor, save selections, queue again to apply. That's the cheapest way to find out whether this workflow suits you before you download 6 GB of SDXL.

Where people get burned

"Source image changed; review this crop again" is the hash binding doing its job. It happens when you re-prepared the dataset from a folder whose contents changed, or when the plan was recorded against a different run. Reopen the editor and redo it.

The crop is not the end of the story for captions. Cropping a photo to just the character can cut out what the caption describes, and nothing in the pipeline notices - the caption audit only checks that text exists. If you crop hard, re-read the captions afterwards.

Stale plans. Because the plan is a JSON string widget, it sits in your saved workflow. Load an old workflow, point it at a new dataset, and the file names won't match - you get Crop plan refers to missing files. Clear the field.

Security, briefly. Those preview routes inherit your ComfyUI instance's access control and aren't isolated per user, so an unauthenticated ComfyUI means fetchable dataset thumbnails. Don't expose a private dataset that way - that's the pack's own advice, and it's right.

CategoryKatori/Illustrious Native Training

Inputs (2)

NameTypeDefaultDescription
datasetILLUSTRIOUS_DATASET
crop_plan_jsonSTRING{}

Outputs (2)

NameTypeDescription
datasetILLUSTRIOUS_DATASET
crop_reportSTRING