PD_number_star
The kitchen-sink batch renamer that also resizes and converts your images
- result_info
This is the pack's do-everything file tool. Point it at a folder and it can rename every file to a numbered scheme, slap a prefix on the originals, convert formats (to jpg/png/txt), and resize images to a max long edge - all in one pass, with a report string coming back out. It's the node you reach for when you just downloaded 300 training images and you want them 001_name.jpg, resized to 1024, with the giant 4K originals deleted, without writing a Python loop.
It lives in the ZHO Tools category, which tells you it was built for a specific Chinese dataset-pipeline habit: sequence-number your files so ordering survives any sort, and normalize image sizes for training buckets. Both instincts are sound.
How it works
Two mutually exclusive rename modes, and it will error if you mix them:
new_nameset - every file becomesnew_name+ a number (or justnew_nameifpaddingis 0). Withnumber_start = truethe number goes first (001_newname.ext); otherwise it goes last (newname_001.ext).prefixset - the original filename is kept andprefix+ an optional number is glued on, again honoringnumber_start.
The delimiter between number and name is your delimiter (default _). Then, on top of renaming: if format_convert is set, extensions change (jpg/png/txt); if it's jpg or png, the image is actually re-encoded, resized so its longest side hits max_size (LANCZOS), and the original file is deleted after. Converting to JPG flattens alpha onto white, which is usually what you want for training data.
The inputs that matter
folder_path- required, must exist or you get an error string back.new_name/prefix- exactly one of these; the node refuses both.padding(0–9) - zero-width or padded numbers.padding = 0means no number at all.format_convert-不修改(don't change), jpg, png, or txt. Note txt conversion just changes the extension, it doesn't re-encode.max_size(64–4096) - longest-edge limit for image re-encoding.
The single output, result_info, is a plain-text report: success/failure counts plus a original → new_name list for every renamed file.
Installing it
Part of Comfyui_PDuse by 7BEII. ComfyUI Manager (search "PDuse") or:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse.git
cd Comfyui_PDuse
pip install -r requirements.txt
Restart. No models to download; the pack pulls numpy, Pillow, scipy, opencv-python, torchvision. Chinese-first docs (Feishu/Bilibili), so expect sparse English.
Where people get burned
The obvious one: this deletes the originals. When an image is re-encoded, the source file is removed - there's no "keep both" option. Work on a copy until you trust the settings. Second: it's non-recursive, only the top level of folder_path. And third, the rename numbering follows os.listdir order after skipping nothing, so the numbering isn't a stable sort unless your files were already ordered - sort your source folder by name before running if sequence order matters to you.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| new_name | STRING | — | |
| prefix | STRING | — | |
| delimiter | STRING | _ | — |
| number_start | BOOLEAN | false | — |
| padding | INT | 10–9 | — |
| format_convert | COMBO | 不修改 | 4 options: NONE, jpg, png, txt |
| max_size | INT | 102464–4096 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result_info | STRING | — |