Nodes/ComfyUI-JDCN/JDCN_TagManipulatorByImageNames
ComfyUI Node

JDCN_TagManipulatorByImageNames

Write caption files for a list of images, with backup

By daxcay·Created 2 years ago·Updated about a year ago· 159
JDCN_TagManipulatorByImageNames
      ImageNames
      TagsDirectorydirectory path
      Backupfalse
      Captionsconcept

      If you've trained or curated a LoRA dataset, you know the chore: next to every image there's a matching .txt caption file, and writing a hundred of them by hand is misery. JDCN_TagManipulatorByImageNames is the pack's node for that job - it takes a list of image names plus a block of tag or caption text and writes the matching sidecar caption file for each one, with a backup toggle so you don't destroy existing captions by accident. It's a dataset-prep utility, not a generator: the tags are yours, it just does the file plumbing.

      What it is

      The interface is unambiguous about the inputs:

      • ImageNames - the list of image files you want caption files for (typically the output of one of the pack's file-list nodes, like JDCN_AnyFileList).
      • TagsDirectory - where the caption .txt files live, which is usually the same folder as the images themselves.
      • Captions - the tag/caption text to write. One block that gets applied across the image list, which suits the "same trigger tags for a whole batch" style of dataset captioning.
      • Backup - when enabled, existing caption files are preserved before anything is written. The one switch that keeps you from nuking a week of hand-captioning in a single bad run.

      It has no outputs - it's a write-and-done output node.

      How it fits the dataset workflow

      The way people actually caption for LoRA training: dump a folder of images, run a tagger, then normalize or rewrite the tags in bulk. This node is the bulk-apply step - feed it the image names and a single consistent caption, and every image gets its sidecar file in one queue. It pairs naturally with JDCN_TXTFileSaver (same pack) if you want per-image custom text, and with the file-list nodes when you need to target a subset rather than a whole folder.

      A note on captioning philosophy while you're here: the community consensus in the training guides is to caption what you want to remain variable and leave fixed features undescribed - over-describing (clothing, backgrounds) just bakes them in as identity. Bulk-applying one caption to everything is great for the "constant" part of that equation and wrong for the variable part, so save this node for the tags every image shares.

      Install

      Part of ComfyUI-JDCN. ComfyUI Manager → Install Custom Nodes → search "JDCN", or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/daxcay/ComfyUI-JDCN.git
      pip install -r requirements.txt
      

      Only pack dependency is piexif.

      One honest caveat

      This node doesn't appear in the pack's current source tree as shipped - the interface above is what ComfyUI exposes (and what this page documents), but the implementation has drifted in and out of releases. If you've installed the pack and can't find the node in your list, check the installed version and update via Manager; the rest of the JDCN file-utility nodes are all present and stable. When in doubt, verify with a single test image and Backup on before you point it at a real dataset - that's good practice with any node that writes files in bulk.

      CategoryJDCN

      Inputs (4)

      NameTypeDefaultDescription
      ImageNamesSTRING
      TagsDirectorySTRINGdirectory path
      BackupBOOLEANfalse
      CaptionsSTRINGconcept

      Outputs (0)

      No outputs