File Padding
A zero-padded frame counter — and don't trust the padding field
- latents
- Number of Images (as str)
- Latent Passtrue
This is the niche-est node in a niche pack, but it scratches a real itch. File Padding counts the .png files in a folder and returns that count as a zero-padded string - so when you're batch-generating frames for an animation or a photo sequence, you can name output files 0001.png, 0002.png, … and keep them in order instead of whatever ComfyUI's default numbering gives you. It also passes your latents straight through, which is the trick that makes it work at all.
Why it takes a latent
The latents input is a passthrough - the node does nothing to it, just hands it back. But without it, the node has no data dependency on the sampling chain, so it would run once at queue start with a stale count. By wiring your model's latent through file_padding and onward to the VAE decode, the node sits inside the generation chain and re-evaluates every run. That's the real mechanism: count the folder, get a fresh number, keep the image pipeline moving.
The output you actually use is Number of Images (as str) - a STRING you'd feed into a filename/text builder. The pack even ships a component workflow (for ComfyUI-Workflow-Component) that chains this into a "Text Concatenate" node to assemble full filenames, so the intended design is clear.
The gotcha the README hides
Here's where it gets honest. The README says: "you have a folder with 3 .png files in it and you have set the padding to 4 it will give you a string '0003'." The shipped code does not do that. I traced it: the padding value is effectively dead code - the only branch that uses it is padding == 1, which returns the raw number with no zeros at all. Everything else pads to the digit length of the count itself, so with 3 files you get "03", with 99 you get "0099", with 1000 you get "00001000".
So treat padding as decorative and never count on fixed-width output matching your padding setting. If you need exactly four digits no matter what, pad the string yourself downstream. This is also why the node is named what it is - the padding is applied, just not the amount you asked for.
Inputs and outputs
path- folder to scan, default./ComfyUI/output/. A trailing slash is added for you. On Pinokio installs, change this to./output/(the README calls this out).padding- as above, mostly cosmetic. Range 1–10.latents- pass-through, wire your latent through it.- Outputs: Number of Images (as str) (STRING) and Latent Passtrue (LATENT) - yes, "Passtrue" is a typo in the pack; it means pass-through.
A couple of sharp edges while you're here: it globs only lowercase *.png, so .PNG files (rare, but Windows-exports happen) won't be counted, and it counts whatever is already in the folder - pre-existing files from earlier runs are included. For a clean sequence, point it at a dedicated output folder you clear between batches.
Install
Same shared install as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/drago87/ComfyUI_Dragos_Nodes
Restart ComfyUI (or install via ComfyUI Manager, searching "ComfyUI_Dragos_Nodes"). No dependencies beyond ComfyUI core, no model downloads. This node has zero search impressions, so you're early to it either way - just keep the padding caveat above in mind, because the README's example will actively mislead you if you trust it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| path | STRING | ./ComfyUI/output/ | — |
| padding | INT | 41–10 | — |
| latents | LATENT | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| Number of Images (as str) | STRING | — |
| Latent Passtrue | LATENT | — |