Nodes/ComfyUI_EmAySee_CustomNodes/EmAySee VisualMachine Save Image And Text V2
ComfyUI Node

EmAySee VisualMachine Save Image And Text V2

Save an image with its prompt in a sidecar .txt — know the overwrite gotcha

By EmAySee·Created about a year ago·Updated 4 months ago· 2
EmAySee VisualMachine Save Image And Text V2
  • images
    filename_prefixSPECTRE
    history_text
    current_prompt

    EmAySee VisualMachine Save Image And Text V2 is an output node that saves your image and writes a companion text file next to it holding the prompt and whatever "state history" you feed in. That pairing - PNG plus a human-readable .txt log - is the whole point. ComfyUI's stock SaveImage embeds the workflow in the PNG metadata; this node instead dumps the story into a sidecar file you can open in any text editor.

    Inputs (all required, and the last two are worth calling out):

    • images - the IMAGE tensor you want saved.
    • filename_prefix - the base name (defaults to "SPECTRE", the pack's branding). The image is saved as {prefix}.png and the text log as {prefix}.txt.
    • history_text - a STRING marked forceInput, meaning you can't type into it; you must wire a string node in. This is the "state history" that gets written into the log.
    • current_prompt - also forceInput. The prompt text that goes into the log as PROMPT:.

    Mechanically it writes to ComfyUI's own output/ directory (the same place stock SaveImage writes), saving the image as PNG and the .txt alongside it with a little "SPECTRE V2 METADATA" header, the filename, the prompt, and the history block. It's an output node, so it has no outputs - it ends the branch.

    Now the gotchas, because there are three real ones:

    1. It overwrites instead of incrementing. Stock SaveImage auto-increments filenames so a re-run never clobbers earlier results. This node does not - every run writes {prefix}.png over whatever was there. Worse, inside a batch of multiple images, each frame is saved to the same {prefix}.png, so only the last one survives. If you're generating batches, change the prefix per run (wire in a timestamp or counter) or you'll lose frames.
    2. The workflow is not in the PNG. The image is saved with pnginfo=None - no embedded metadata. You can't drag the PNG back into ComfyUI to recover the workflow the way you can with stock saves. Your prompt and history live in the .txt, and only if you remembered to feed them in.
    3. Both text inputs are forced connections. If you leave history_text or current_prompt unwired, the run fails. Keep a spare "Show Text" or string node handy to feed them, or use a text-input node that can hold your prompt.

    How to install

    Pack install as usual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/EmAySee/ComfyUI_EmAySee_CustomNodes
    

    Restart ComfyUI, or search ComfyUI_EmAySee_CustomNodes in ComfyUI Manager. No requirements.txt, no model downloads. It only uses PIL and numpy, both already in ComfyUI's environment.

    Where it fits

    This is clearly the output stage of the author's own automated "VisualMachine/SPECTRE" generation pipeline - the one the pack's ASCII banner announces on startup. If you're building an automation loop that wants a clean prompt log next to every image (for later tagging, curation, or feeding history back into an LLM-driven workflow), this node gives you that in two files instead of one. If you just want images with recoverable workflows, the stock SaveImage is the better default; the trade-off here is a readable text record over self-contained PNGs.

    Given the overwrite behavior, use it with a unique prefix per run and you're fine. Ignore that and it will quietly eat your previous output - which, to be fair, is a pretty memorable way to learn the difference between this and the stock node.

    CategoryEmAySee_Automation/Image

    Inputs (4)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGSPECTRE
    history_textSTRING
    current_promptSTRING

    Outputs (0)

    No outputs