Clean Data
A real crop-and-resize tool that lives inside your ComfyUI graph
Calling this a "data cleaning" node oversells it a little. It doesn't dedupe, caption, or filter anything. What the Clean Data node from comfyui-DataCleaning actually does is simpler and still genuinely handy: it puts an interactive image-cropping and resizing workbench inside ComfyUI, where you load a batch of photos, drag a crop box over each one, and save the results out to a folder. It calls no API, needs no key, and the entire dependency story is Pillow. For anyone who has ever prepped a LoRA dataset by hand in an image editor, that's the whole pitch.
Why you'd reach for it
Dataset curation beats every training knob. The modidex KB hammers this in its training essay: people prune near-duplicate images, crop out watermarks, and cut away cluttered backgrounds before a single training step. That's exactly this node's lane. Load your 30 reference photos, drag the crop window to the subject on each, and hit "save images" - out come uniformly-sized crops named like cropped_image_1699999999999_cropped_512x512.png. The filename even bakes in the target dimensions, which is a small thing that saves you a headache when you're bucketing a dataset.
It's also just nice for cleaning up personal photo collections, which is the author's stated intention ("data security... on your personal data"). One fair warning: this is interactive, not batch-automated. It shines at 20–100 images. If you're feeding thousands of images through it, you'll be better served by a scripted crop.
How it works
The mechanism is a small surprise for a ComfyUI node: there's no real graph computation at all. Clean Data is an OUTPUT_NODE - it returns no tensors and wires into nothing. Instead, the shipped JS (js/cleandata.js) draws a full canvas widget on the node. You import images with the "select images" button or by dragging files in, then drag and resize a white crop box over each preview. Two number fields set the global crop width and crop height (defaults: 300×200).
When you save, the browser scales the crop region to those target dimensions, base64-encodes it, and POSTs it to a local endpoint the pack registers (/save_cropped_image_yc). The Python side decodes it with Pillow and writes it to disk. That split is why the node feels instant and needs almost no dependencies - the heavy lifting happens in your browser, not in Python.
The inputs that matter
The schema is a single optional field:
- save_img_path - a plain string, default
"Set your path here!". This is the folder where saved crops go. If you don't set it to a real path, the save button politely refuses.
That's it. There are no outputs, which trips up people expecting to chain this into a workflow. It's a standalone utility that dumps files to disk - treat it as an editor, not a pipeline stage.
Installing it
Easiest path is ComfyUI Manager: search "comfyui-DataCleaning" (or "Clean Data") and hit install. Otherwise:
cd ComfyUI/custom_nodes
git clone https://github.com/Jacky-MYQ/comfyui-DataCleaning
pip install -r requirements.txt # just Pillow
Restart ComfyUI and the node appears under the "Clean Data" category. No models to download, no heavy deps to fight - this is as frictionless as custom nodes get.
Where people get burned
- Forgetting the save path. The default string isn't a directory, so "save images" throws an alert until you set it. Set it once and forget it.
- Expecting graph outputs. It's UI-only by design. Don't try to wire it into a workflow.
- Big datasets. The whole thing is browser-memory and per-image clicks. Small curated sets, great; mass batch jobs, use something else.
- Format limits. The file picker accepts JPEG and PNG only.
It's a small, single-purpose tool from a small pack - the author's still planning a background-removal/segmentation feature that isn't shipped yet. For its one job, cropping and resizing photos into a clean training set, it does exactly what it says and stays out of your way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| save_img_pathopt | STRING | Set your path here! | — |
Outputs (0)
No outputs