Add a 2026.11.04 notice to README explaining that many node inputs and outputs were renamed or reordered and need reconnecting, and update the ja/en/zh node docs and changelog for LIST/ARRAY, x / y_items, the new D2 List Converter and the deprecated list nodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 KiB
- Top
- Node / Image Node / Text Node / XYPlot Node / Float Palet
- Workflow
Node
🍅 Text Node
D2 Regex Replace
- Can replace using regular expressions
- Multiple conditions can be specified
- Supports reuse of regex match strings (e.g., \1, \2)
- Target string can be specified by "tag unit" or "whole"
Input
text- Target string for search
modeTag: Break downtextby newlines and "," and replace individuallyAdvanced: Replacetextas a whole
regex_and_output- List of search strings and output strings
- Write in following format
- If output string is empty, matched part is deleted
- No limit on number of entries
Search string 1
--
Output string 1
--
Search string 2
--
Output string 2
Output
text- Text after replacement
Sample
Sample for removing Pony series quality tags.
Mode: Tag
Input text
score_9, score_8_up, (score_7_up, score_6_up:0.8) , rating_explicit, source_anime, BREAK
1girl, swimsuit
Regex Replace
.*(score_|rating_|source_).*
--
--
BREAK
--
Output text
1girl, swimsuit
D2 Regex Switcher
- Searches input text with regex and outputs matching text
- Main purpose is switching quality tags per Checkpoint
- When matching string is found in input
text, outputs target string and match index (starting from 0) - Can concatenate strings at front and back
Input
text- Search target string
prefix- String to concatenate at front
suffix- String to concatenate at back
regex_and_output- List of search strings and output strings
- Write in following format
pre_delim- Character inserted between
prefixandregex_and_output Comma:,/Line break: newline /None: nothing
- Character inserted between
suf_delim- Character inserted between
regex_and_outputandsuffix
- Character inserted between
Output
combined_text- String combining
prefix+ output string +suffix
- String combining
prefix/suffix- Input passthrough
D2 Multi Output
- Node that outputs generic parameters like seed and cfg as lists
Input
typeFLOAT: Floating point numbers. For CFG etc.INT: Integers. For steps etc.STRING: Strings. For sampler etc.SEED: Can input seed values with random number button
Add Random- Adds random numbers to input field
- Only shown when
typeisSEED
Output
x / y_items- Plain line-break separated text
- Used with
D2 XY Plot,D2 XY Plot Easy,D2 XY Plot Easy Mini
LIST- Splits by line break and outputs the items one by one. The connected node runs once per item
ARRAY- Splits by line break and outputs as an array
D2 List Converter
- A node that converts between
LIST(ComfyUI's list, which outputs items one by one) andARRAY(ComfyUI's built-in Array type, which outputs an array as a single value), and also converts them to a string - Combines the features of
D2 List To StringandD2 XY List To Plot
Input
LIST/ARRAY- Value to convert. Connect either one
- When both are connected, they are joined in the order
LIST→ARRAY
separator- Delimiter for the
STRINGoutput Comma + Space: Join with,Comma: Join with,Line break: Join with line breaksSemicolon: Join with;Space: Join with a spaceNone: Join with no delimiter
- Delimiter for the
Output
x / y_items- Line-break separated text. Used with
D2 XY Plot - Line breaks inside each item are removed
- Line-break separated text. Used with
LIST- Outputs the items one by one
ARRAY- Outputs as an array
STRING- Text joined with
separator - Line breaks inside each item are kept
- Text joined with
D2 List To String
Deprecated. Please use D2 List Converter instead.
D2 Text Concat
- Text concatenation node with an adjustable number of inputs
- Adjust the number of input fields with
text_count, then join the texts connected totext_1..text_N separatoris shared withD2 List To String
Input
text_count- Adjusts the number of input fields (1 to 50)
separatorComma + Space: Join with,Comma: Join with,Line break: Join with line breaksSemicolon: Join with;Space: Join with a spaceNone: Join with no delimiter
skip_empty- When
true, skips unconnected or empty (whitespace/line-break only) inputs - Prevents stray delimiters (
, ,) from appearing
- When
D2 Filename Template / D2 Filename Template2
- A node for creating string templates by incorporating date and parameters from other nodes
D2 Filename Template2is a version that supports multiple lines- It is also possible to retrieve values from arrays, dictionaries, and objects
- Preset feature for commonly used formats like Stable Diffusion webui A1111-style metadata
- You can add presets by editing
custom_nodes/d2-nodes-comfyui/config/template_config.yaml
- You can add presets by editing
Input
arg_{number}- Import values from other nodes
format%date:{yyyy/MM/dd/hh/mm/ss}%yyyy: YearMM: Monthdd: Dayhh: Hourmm: Minutess: Second
%{node name}.{key}%- Retrieves values by specifying node name and item name
- Example:
%Empty Latent Image.width%: Get width from the Empty Latent Image node
%node:{id}.{key}%- Retrieves values by specifying node ID and item name
- Example:
%node:8.width%: Get width from node ID 8
%arg_{number}%- Embed input values
%arg_{number}:ckpt_name%- Embed checkpoint name with
.safetensorsremoved
- Embed checkpoint name with
%arg_{number}:preset.{preset_name}%- Presets can be added by editing
custom_nodes/d2-nodes-comfyui/config/template_config.yaml
- Presets can be added by editing
%exec_{number}[{index}]%- Retrieves the value at
{index}from the array input toarg_{number}
- Retrieves the value at
%exec_{number}['{key}']%- Retrieves the value for
{key}from the dictionary input toarg_{number}
- Retrieves the value for
%exec_{number}.{key}%- Retrieves the value for
{key}from the object input toarg_{number}
- Retrieves the value for
arg_count- Increase or decrease the number of input items
normalization- Filename sanitization option
Retrieving node information connected to `arg_N`, using the node name, etc.
Retrieving `steps` and `sampler_name` from the `d2_pipe` object, which summarizes generation parameters.
Using the preset `a1111` with the value input to `arg_1`. Using `D2 Pipe` to add the checkpoint name.
D2 Prompt
- You can select LoRA from the
CHOOSEbutton and insert an A1111-style LoRA prompt - Delete comments in text
- Targets lines starting with "#", lines starting with "//", and text between "/" and "/"
- Displays token count at the bottom (works when
token_countistrue) - Uses "ViT-L/14" CLIP for token count measurement. Please use
D2 Token Counterif you want to use other CLIP models
About Comment Shortcut Keys
- Comment shortcut key (ctrl + /) is available in all text boxes
- Shortcut keys can be changed in
Settings > D2 > shortcutKey - Delete the content above if you want to disable it
D2 Prompt Sanitizer
- A node that cleans up prompt strings
- Converts
_(underscore) to a space (long_hair→long hair) - Ensures a single space after each
,(comma) and tidies up surrounding whitespace (a , b→a, b) - Collapses redundant consecutive commas and removes commas at the start of a line (
a,, ,b→a, b) - Can also convert line breaks, remove duplicate tags and remove comments
- Each transformation can be toggled on / off individually
Input
underscore_to_space: Convert_to a spacespace_after_comma: Tidy the whitespace around commas and normalize it to,(line breaks are preserved)remove_extra_comma: Collapse redundant consecutive commas (,,/, ,) into one and remove commas at the start of a line (line breaks are preserved)protect_lora: Protect LoRA notation enclosed in<...>from conversion (keeps the underscores in<lora:my_lora:1>)protect_score: Protect Pony quality tags such asscore_9/score_8_upfrom conversionnewline_mode: How to convert line breakskeep: Do nothing (preserve line breaks)add_comma: Append,to the end of each line (line breaks preserved; empty lines and lines already ending with,are left as-is)to_comma: Convert line breaks to,and join into a single lineto_space: Convert line breaks to a spaceremove: Remove line breaks (1girl\nsmile→1girlsmile; useful for joining Japanese text)
remove_duplicate_tags: Remove duplicate tags (keeps the first occurrence; comparison ignores_vs. space differences and letter case)strip_trailing_comma: Remove a comma at the very end of the whole string (useful together withadd_comma)comment_type: Which comment styles to remove. Same asD2 Prompt# + // + /**/: Remove lines starting with#, lines starting with//, and everything between/*and*/(can span multiple lines)# only/// only//* */ only: Remove only that styleNone: Do nothing (default)
The transformations run in this order: remove comments → remove duplicate tags → convert line breaks → convert underscores → remove extra commas → normalize commas → strip trailing comma. Any
,,left behind byremove_duplicate_tagsis cleaned up byremove_extra_comma, so turning both on gives a tidy result.
D2 Convert NAI Prompt
- Converts prompt weights between StableDiffusion and NovelAI
- Performs the same conversion as the
Prompt convert dialoginside a workflow - A weight's range ends at a line break (conversion never spans lines)
- Does not tidy up duplicate commas or whitespace. Connect
D2 Prompt Sanitizerafter it if needed
Input
prompt: The prompt to convert (input only)convert: Conversion directionsd_to_nai: StableDiffusion format → NovelAI formatnai_to_sd: NovelAI format → StableDiffusion format
mode: NovelAI weight notationnumber: Numeric format (1.2::aaa ::)brace: Brace format ({{aaa}}/[[aaa]]). Tags with a weight of 0 or less cannot be expressed with braces, so only those tags are output in numeric format
remove_negative: Only effective withnai_to_sdandnumber. Removes tags with a negative weight- Commas around removed tags are kept (
-2::aaa::, 1.2::bbb::→, (bbb:1.2)) - Tags with a weight of 0 are not removed (a weight of 0 still affects the generated image)
- Commas around removed tags are kept (
Numeric format conversion rules
sd_to_naialways puts a space before the closing::((aaa5:1.2)→1.2::aaa5 ::). This prevents the5::inaaa5::from being misread as the start of a weightnai_to_sdalso handles a missing closing::. An unclosed weight extends until the start of the next weight or the end of the line1.2::blonde hair, 1.3::from side::→(blonde hair:1.2), (from side:1.3)1.2::aaa, bbb::→(aaa, bbb:1.2)(a weight applied to multiple tags is kept as is)
- Negative weights are written with the minus sign before the number, like
(aaa:-2)
D2 Moss Item / D2 Moss Prompt
- Nodes for building layout prompts (JSON format) for the image generation model MOSS-Image
- The area of a mask is used as the position (bbox) where an element is placed
- The bbox coordinates (pixel coordinates with the canvas center as the origin) are calculated automatically, so you don't need to calculate them by hand. The layout follows when you change the resolution
- Connect them in the order
D2 Create Masks→D2 Moss Item→D2 Moss Prompt - Layout prompts are an experimental feature of MOSS-Image, so only the fields described in the USERGUIDE are supported
D2 Moss Item
- Creates one element of the layout
- The rectangle that encloses the non-zero area of the mask becomes the bbox. If the mask is empty, the whole canvas becomes the bbox
Input
mask: Mask of the area where the element is placedlabel: Type of the elementobject: Draw an object, a person, etc.text: Draw text
caption: Description of how the element looks (size, style, position, etc.)- You can comment out text the same way as in
D2 Prompt(lines starting with#///,/*…*/)
- You can comment out text the same way as in
text: The text to draw. Used only whenlabelistext- To insert a line break, type
\nor connect another node (such asD2 Prompt)
- To insert a line break, type
Output
moss_item: Data for one element. Connect it toD2 Moss Prompt
D2 Moss Prompt
- Combines a description of the whole image and multiple
moss_iteminputs into a JSON string prompt
Input
meta: Tags describing the type of image. Multiple tags can be entered, separated by commas- Examples:
poster/photograph/illustration, anime
- Examples:
canvas_type: Usually leave it assinglesummary_caption: Description of the scene and art style of the whole image- Comments can be used the same way as in
caption
- Comments can be used the same way as in
item_count: Number ofmoss_iteminputsmoss_item_{number}: ConnectD2 Moss Item
Output
prompt: JSON string of the layout prompt. Connect it to a text encoder
If
meta/canvas_type/summary_captionare left empty, they are omitted from the JSON.
D2 Token Counter
- Counts tokens in prompts
D2 Load Text
- A general-purpose node that loads a text file
- For batch-editing training captions, use it to read the path obtained by
D2 Folder Image Queuewith*.txt
Input
file_path- Full path of the text file to load
encode_to_utf8true: Auto-detect the character encoding and convert to utf-8 when readingfalse: No conversion (read as utf-8)
Output
text- The file content (returned as-is, no formatting; empty string if the file does not exist)
file_path- Passes through the input
file_path(for feeding intobase_filenameofD2 Save Caption)
- Passes through the input
D2 Load CSV
- A node that loads a CSV / TSV file and extracts a range of rows and columns
- Data with commas (like prompts) is assumed to be double-quoted (standard CSV escaping)
- To keep memory bounded even for large files, there is a single output whose format is switched by
output_mode
Input
file_path- Full path of the file to load
file_typecsv: comma-separated /tsv: tab-separated. The delimiter of the input file
encode_to_utf8true: Auto-detect the character encoding and convert to utf-8 when reading
output_modelist: Output as a 2D arraycsv: Output as line-break + comma separated text
row_index/column_index- Range of rows/columns to output (1-based). Empty means all
3: only the 3rd row (column)2-: from the 2nd row (column) to the end-4: rows (columns) 1 to 42-4: rows (columns) 2 to 4- A malformed format (
0,2--4, non-numeric, etc.) stops execution with an error (so wrong data is not passed on)
use_doublequote- When
output_mode:csv, double-quote every cell falseproduces a plain comma join, so cells containing commas lose their separation ("AAA,BBB","XXX,YYY"->AAA,BBB,XXX,YYY)
- When
Output
output- The selected data. A 2D array or text depending on
output_mode
- The selected data. A 2D array or text depending on
lines_count- Number of rows in the selected range
file_path- Passes through the input
file_path
- Passes through the input
D2 Save Caption
- A node that formats tags and saves a caption file
- Saves to the path obtained by replacing the extension of
base_filenamewithextension(e.g.d:/images/aaa.jpg->d:/images/aaa.txt) - Formatting runs in this order: split -> trim -> unify separator -> remove escape -> exclude -> dedupe -> prepend -> trailing comma
Input
base_filename- The source path for saving. Receives
image_pathofD2 Folder Image Queueorfile_pathofD2 Load Text - Stops with an error if empty (to prevent saving to an unintended location)
- The source path for saving. Receives
text- The caption body (from
WD14 TaggerorD2 Load Text)
- The caption body (from
extension- Extension of the file to save (e.g.
txt)
- Extension of the file to save (e.g.
exclude_tags- Tags to exclude. Separated by both commas and line breaks
- Writing
regex/pattern/excludes tags matching the regular expression (exclude only) - Bracket escaping is ignored in the comparison (a prompt tag
rem_\(re:zero\)can be excluded by an exclude tagrem_(re:zero))
prepend_tags- Tags to prepend. Comma-separated. Tags that already exist are not added
word_separator- Unify the word separator (to align a mix of
blue eyesandblue_hair) underscore(default): Unify spaces to_(blue eyes->blue_eyes)space: Unify_to spaces (blue_hair->blue hair)none: No conversion
- Unify the word separator (to align a mix of
remove_escapetrue: Strip bracket escaping (\(\)\[\]) from the output tags (rem_\(re:zero\)->rem_(re:zero)). For training captions
trailing_commatrue: Add a trailing comma
ignore_casetrue: Ignore case when matching for exclusion
backuptrue: If a file of the same name exists, rename the old file to.bakbefore saving
dry_runtrue: Do not save to file; only check the formatted result in thetextoutput (preview of the conversion)
Output
text- The formatted caption
file_path- Full path of the save destination (the planned path when
dry_run)
- Full path of the save destination (the planned path when
D2 Tag Report
- A node that aggregates tag frequency from captions in the specified folder and builds an exclude-tag list
- The
Get tagsbutton shows the aggregated result intext. The user edits which tags to keep/remove and passes it toexclude_tagsofD2 Save Caption - Prefixing a line with
//or#makes it a comment line - When a tag dictionary is given to
exclude_tags, only the tags not listed in the dictionary are counted- This surfaces mistyped prompts such as a missing comma (
blue eyes twintails) or a missing space (blondehair)
- This surfaces mistyped prompts such as a missing comma (
- For how to use
D2 Tag ReportandD2 Save Caption, see this article (Japanese)
Input
folder- The folder containing the caption files (full path)
include_subfolderstrue: Also target subfolders
extension- Target extension (e.g.
txt)
- Target extension (e.g.
order_bycount_9-0: Descending by occurrence countcount_0-9: Ascending by occurrence counttag_a-z: By tag name (A->Z)tag_z-a: By tag name (Z->A)
without_counttrue: Do not show occurrence counts in the report
exclude_tags- The file path of the tag dictionary to exclude from counting (full path)
- Note that you specify the path of the dictionary file, not its contents
output_typeremove_comment: Remove comment lines and output the rest (workflow: mark tags to remove with comments)output_comment: Output only comment lines (workflow: comment out only the tags to remove)
separatornewline: Output line-separated (recommended, so entries containing commas such asregex/pattern/are not broken)comma: Output as a single line separated by comma + space
Output
text- The edited tag list (passed to
exclude_tagsofD2 Save Caption)
- The edited tag list (passed to
About exclude_tags
-
A feature for surfacing tags that are likely mistyped, that is, tags not listed in the dictionary
-
Tags listed in the dictionary are not counted, so only tags missing from the dictionary remain in the report
-
Three dictionary formats are supported. In all of them the first column is read as the tag
-
A plain list of tags
1girl solo -
A format without a header row (such as ComfyUI Custom Scripts)
1girl,4114588 solo,3426446 -
A format with a header row (such as ComfyUI Auto Complete Plus)
tag,category,count,alias 1girl,0,4974288,"girl,woman,lady"
-
-
Matching ignores letter case, the difference between spaces and underscores (
long hairandlong_hair), and bracket escaping (\(and() -
Note: The
Get tagsbutton runs before the workflow executes, so a value connected from another node cannot be read. Always type the dictionary path directly into this field