Nodes/Visual Filename Manager (Studio Leiel)/Filename Template (Studio Leiel)
ComfyUI Node

Filename Template (Studio Leiel)

Hate drag-and-drop? This filename node speaks fluent template instead

By StudioLeiel·Created 25 days ago·Updated 14 days ago· 0
Filename Template (Studio Leiel)
  • run_after
  • filename_prefix
  • folder
  • filename
  • report
folder_template{date:%Y-%m-%d}/{Title|string}/krea2[[/{lora:1}]]
file_template{date:%Y-%m-%d}_K2_{Title|string}[[_{loras}]][[_Enhancer({Krea2T Enhancer Advanced|strength}-{Krea2T Enhancer Advanced|text_scale})]][[_{@KSampler|sampler_name}_{@KSampler|scheduler}]][[_Step({@KSampler|steps})]][[_Shift({@ModelSamplingAuraFlow|shift})]][[_time({elapsed}s)]]
max_filename_chars190
escape_percenttrue
fallback_nameLEIEL_FALLBACK

The drag-and-drop Visual Filename Manager (Studio Leiel) is this pack's showpiece, but some of us type. Filename Template (Studio Leiel) is the keyboard-first version of the exact same idea: build your output folder and filename from any widget in the workflow, with zero string nodes and zero wires running after your render. If you've ever maintained a 40-node spaghetti of Text Concatenate just to get _steps(30)_ into a filename, you know why that matters - those nodes run after rendering, so one break means a finished image that never saves.

Instead of dragging chips, you write a template. It looks like this (that's the actual default file_template):

{date:%Y-%m-%d}_K2_{Title|string}[[_{loras}]][[_Enhancer({Krea2T Enhancer Advanced|strength}-{Krea2T Enhancer Advanced|text_scale})]][[_Step({@KSampler|steps})]]

Readable enough: {node title|widget} grabs a widget by node title, {@ClassName|widget} grabs one by class, {#id|widget} by node id, and {date}, {time}, {elapsed}, {loras}, {lora:1} cover the special cases. The [[ ... ]] marks an optional group - if any token inside fails to resolve, the whole group vanishes. Bypass your enhancer and the _Enhancer(...) chunk quietly disappears instead of leaving you a _() orphan in the middle of a name. Six months later the filename still tells you exactly what ran.

How it works

Under the hood it's the same engine as the drag version. ComfyUI passes every node a hidden PROMPT (node id → class → widget values for the whole graph) and EXTRA_PNGINFO (the workflow JSON with titles), and this node builds a lookup index from them. Selectors match by id, then class, then title, so {@KSampler|steps} finds the KSampler wherever you put it. Spec strings after a second | format the value - blank means "strip path and extension", raw keeps it as stored, int rounds, cut12 takes the first 12 characters, or any Python format spec like .2f.

Two design guarantees worth knowing. It never raises: every failure path returns LEIEL_FALLBACK/2026-08-21_143022-style output rather than an exception, so a render always gets saved. And it returns NaN from IS_CHANGED so it recomputes every run - necessary because time tokens can't be cached, and ComfyUI's "always rerun" idiom (the same one clock and counter nodes use).

Inputs and outputs

You'll actually touch three things:

  • folder_template - the path part; / in it becomes subdirectories.
  • file_template - the name part.
  • max_filename_chars (default 190) - truncates the tail past this, guarding the Windows 260-character path limit.

escape_percent (default on) rewrites % so downstream save nodes don't try to re-substitute it - that's the classic trap where a model name containing % becomes garbage. fallback_name is only used if everything fails. The optional run_after input is for the {elapsed} token: connect the image line that goes to Save Image so this node runs after sampling, or the timer reads near-zero.

Outputs: filename_prefix (folder + name - wire it to Save Image's filename_prefix widget after converting that to an input), separate folder and filename, and report, which lists any tokens that failed to resolve and tells you why.

Install

ComfyUI Manager → search "Visual Filename Manager" → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/studioleiel/comfyui-visual-filename-manager

Restart ComfyUI, then hard-refresh the browser (Ctrl+Shift+R) - the UI is a frontend extension and caching hides it. Zero dependencies, Python standard library only.

Troubleshooting

  • A [[group]] disappears → something inside failed to resolve. Check the report output - it names the offender.
  • {elapsed} reads 0.0 or (no Timer Anchor node) → connect run_after, and note elapsed starts at the beginning of the workflow unless you add a Timer Anchor earlier in the line.
  • "no widget 'x'" → you guessed a widget name. Drop a Graph Dump into the workflow - it prints every node's title, class, widget names and values, and even the {node title|widget} token you should use.

This is the sibling of the drag UI, and the honest comparison is taste: chips are faster to build and show a live preview; templates are greppable, version-control-friendly, and paste beautifully into a note or a chat. New pack, tiny community footprint so far, but the safety net (never raises, always saves) is the right foundation for a node whose job is literally guarding your finished renders.

CategoryStudio Leiel

Inputs (6)

NameTypeDefaultDescription
folder_templateSTRING{date:%Y-%m-%d}/{Title|string}/krea2[[/{lora:1}]]
file_templateSTRING{date:%Y-%m-%d}_K2_{Title|string}[[_{loras}]][[_Enhancer({Krea2T Enhancer Advanced|strength}-{Krea2T Enhancer Advanced|text_scale})]][[_{@KSampler|sampler_name}_{@KSampler|scheduler}]][[_Step({@KSampler|steps})]][[_Shift({@ModelSamplingAuraFlow|shift})]][[_time({elapsed}s)]]
max_filename_charsINT19040–250
escape_percentBOOLEANtrue
fallback_nameSTRINGLEIEL_FALLBACK
run_afteropt*

Outputs (4)

NameTypeDescription
filename_prefixSTRING
folderSTRING
filenameSTRING
reportSTRING