Nodes/ComfyUI-IMGNR-Utils/DIY Node Writer (IMGNR)
ComfyUI Node

DIY Node Writer (IMGNR)

Build your own ComfyUI node from a text file — no Python required

By ImagineerNL·Created about a year ago·Updated 5 months ago· 21
DIY Node Writer (IMGNR)
    • inspect
    select_fileCreate New > Use Filename Below
    filenamemy_diy_node
    modepopulate
    content

    Every KSampler ships with a dropdown listing every sampler and scheduler ever written, and you use maybe four. Every save node wants a filename convention you can never remember. The DIY system in ComfyUI-IMGNR-Utils is the answer to both: define your own little node in a plain .txt file, and it becomes a real node with dropdowns, input fields, and typed outputs - no Python, no restart of the code, just a text format.

    The DIY Node Writer is the management side of that system. It writes, edits, and validates those text files from inside ComfyUI, instead of you hand-editing them in a text editor.

    How the whole DIY thing works

    This was called "Txt2Combo" before v3.2.0 renamed it, and the idea is exactly that: text becomes a combo node. At startup the pack scans ComfyUI/user/IMGNR_Utils/DIY-nodes/ - note the underscore, the README says IMGNR-Utils but the code wins - and every .txt there gets compiled into a node called DIY: <filename> (IMGNR).

    The format is simple. A line like [Resolution]; [Width=int]; [Height=int]; [Ratio=float] defines a section: the first column becomes the dropdown, every column becomes an output, and =int, =float, =bool type them properly. A section with no data rows becomes a free input field (STRING, INT, FLOAT, BOOLEAN, or a =textbox multiline). And [concat=name] lines glue values together into a string output - including conditional { ... } blocks that only appear if a referenced field isn't empty. Sections can be combined in one file, so a single node can carry a resolution dropdown, a format dropdown, and a prompt textbox with 12 typed outputs, like the bundled DIY: example node demonstrates.

    The Writer's inputs

    • select_file - pick an existing .txt to edit, or "Create New > Use Filename Below".
    • filename - the base name for a new file (my_diy_node by default); a .txt extension is added for you.
    • mode - overwrite, append, or populate. Populate reads a file's contents into the content box without writing anything - useful for loading a file you want to tweak.
    • content - the node definition itself, with sections, rows, and concat lines. The tooltip sums it up: "Use ; to separate columns. Use [Section] for new tables."

    The single output is inspect, and it's the coolest feature here. Wire it to any existing combo input in your workflow (a KSampler's sampler list, say), run the writer, and it pulls that node's options into the content box - then you delete the 90% you don't use and keep your favorites. No retyping.

    The gotchas that will bite you

    • Structure changes need a restart. Adding a new file or a new [Section] changes the node's input/output slots, and ComfyUI only defines those at startup. New values inside an existing section, though, need nothing more than a Refresh (R) - the node re-reads the file every run.
    • Validation is real. The writer validates on save/run: bad types, unbalanced brackets, unknown concat references, and too many values in a row all get rejected with an error listing the line number. This is a good thing - a malformed file would otherwise silently produce a broken node.
    • The example file resets on every launch. example.txt is regenerated at startup, so don't build your workflow on DIY: example - copy it to a new filename first.
    • Files live in User/IMGNR_Utils/DIY-nodes/ (underscore, remember), and the library of examples ships in the pack's DIY-node-library/ folder for reference.

    Installing it

    Zero dependencies, same as every node in the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ImagineerNL/ComfyUI-IMGNR-Utils
    

    or search "ComfyUI-IMGNR-Utils" in ComfyUI Manager and restart. The Writer appears under IMGNR/DIY nodes. It's an OUTPUT_NODE, so you can queue it by itself to write or populate files without running your whole pipeline.

    CategoryIMGNR/DIY nodes

    Inputs (4)

    NameTypeDefaultDescription
    select_fileCOMBOCreate New > Use Filename Below2 options: Create New > Use Filename Below, example.txt
    filenameSTRINGmy_diy_node
    modeCOMBOpopulate3 options: overwrite, append, populate
    contentSTRINGUse ; to separate columns. Use [Section] for new tables.

    Outputs (1)

    NameTypeDescription
    inspect*Connect to a DIY Node or ANY combobox to populate widget below