Extensions/ComfyUI-BatchAnimeTimm
ComfyUI Extension

ComfyUI-BatchAnimeTimm

Batch-tag a folder of anime images with AnimeTimm and save matching UTF-8 caption files.

By zzczzcx1·Created about a month ago·Updated a day ago· 1
zzczzcx1/ComfyUI-BatchAnimeTimm
Nodes1
On cloudLocal install
CategoryAnimeTimm
Stars1
Updateda day ago
Readme

ComfyUI-BatchAnimeTimm

中文说明

A focused ComfyUI output node that tags every image in a folder with ComfyUI-animetimm and writes one matching UTF-8 .txt caption file per image.

Required companion node: install ComfyUI-animetimm before using this extension. BatchAnimeTimm reuses its model loader and inference code; it does not download or bundle a second copy of AnimeTimm.

Why use it?

  • Process a dataset folder with one node and one queue operation
  • Write image.png to image.txt with deterministic filename matching
  • Load the selected AnimeTimm model once and reuse it for the entire run
  • Resume interrupted jobs by enabling skip_existing
  • Control threshold, tag categories, model, and underscore formatting
  • Stop safely through ComfyUI's cancel button
  • Reject filename collisions instead of silently overwriting captions
  • Use atomic writes so an interrupted save cannot leave a partial caption

Installation

ComfyUI Manager / Registry

  1. Install ComfyUI-animetimm.
  2. Install ComfyUI-BatchAnimeTimm (batch-anime-timm).
  3. Restart ComfyUI.

Manual

cd ComfyUI/custom_nodes
git clone https://github.com/MakkiShizu/ComfyUI-animetimm.git
git clone https://github.com/zzczzcx1/ComfyUI-BatchAnimeTimm.git

Install the upstream requirements using the same Python environment that runs ComfyUI, then restart ComfyUI:

python -m pip install -r ComfyUI-animetimm/requirements.txt

Usage

  1. Add Batch AnimeTimm Tagger from the AnimeTimm category.
  2. Enter the image folder and, optionally, a separate output folder.
  3. Choose the model and tag settings.
  4. Queue the workflow. The node's summary output contains the final counts.

An importable example is included in workflow_example.json.

| Parameter | Default | Description | |---|---|---| | folder_path | empty | Folder containing source images; only the top level is scanned | | output_dir | empty | Caption destination; empty means folder_path | | threshold | 0.35 | Minimum confidence threshold | | model_repo | animetimm/convnextv2_huge.dbv4-full | AnimeTimm model | | include_general | True | Include general tags | | include_character | False | Include character tags | | include_artist | False | Include artist tags | | include_rating | True | Include rating tags | | replace_underscore | False | Replace underscores with spaces | | use_custom_threshold | False | Ignore per-tag best thresholds | | file_extensions | .png,.jpg,.jpeg,.webp,.bmp,.gif | Comma-separated extensions | | skip_existing | False | Do not replace an existing destination caption |

Output and safety behavior

  • Captions are comma-separated tag strings stored as UTF-8.
  • Existing captions are replaced unless skip_existing is enabled.
  • Animated GIF input uses its first frame.
  • cat.jpg and cat.png would both target cat.txt; the node detects this before inference and stops with a list of conflicting files.
  • A model load failure stops the job and does not create an empty caption.
  • Corrupt or unreadable images are reported at the end and make the ComfyUI execution fail. Successfully written captions remain available, so the run can be resumed with skip_existing.

Development

Run the regression suite with a Python environment that provides ComfyUI's normal torch, numpy, and Pillow dependencies:

python -m unittest discover -s tests -v

Acknowledgements

License

MIT