Nodes/ComfyUI NAI Prompt Converter/NAI Prompt Extractor πŸ”
ComfyUI Node

NAI Prompt Extractor πŸ”

Pull the prompt, seed and settings back out of a NovelAI PNG

By raspie10032Β·Created 2 years agoΒ·Updated about a year agoΒ· 2
NAI Prompt Extractor πŸ”
    • prompt
    • negative_prompt
    • seed
    • steps
    • sampler
    • cfg_scale
    • raw_metadata
    • width
    • height
    • image
    β—„original_fileexample.pngβ–Ί
    β—„reload_filesfalseβ–Ί

    You've got a PNG that came out of NovelAI months ago - great composition, exact character you want to reuse - and the only thing you have left is the file itself. The NAI session's long gone. NAI Prompt Extractor reads the generation recipe straight back out of the image: prompt, negative prompt, seed, steps, sampler, CFG, and dimensions, no re-typing anything.

    This works because NovelAI does the same trick ComfyUI does for its own outputs: it embeds the generation metadata directly into the PNG file when it saves the image. ComfyUI stuffs the entire workflow graph into every PNG it exports, which is why sharing a single image can hand someone your whole pipeline - this node is that same idea from the other side of the fence, reading NovelAI's own metadata format back out. The pack credits NovelAI's own image-metadata project and bedovyy's ComfyUI_NAIDGenerator for the parsing logic, so it's not reverse-engineered guesswork.

    The inputs that matter

    Two, and they're both about picking the file:

    • original_file - a dropdown of images sitting in ComfyUI's input folder, same picker pattern as the stock LoadImage node. Drop your NAI PNG in there first.
    • reload_files (boolean, off by default) - flip it if you just added a file and it isn't showing up in the dropdown yet. Saves you a full ComfyUI restart just to refresh a file list.

    What comes out

    Ten outputs, and this is the one place you need to read carefully: everything except the last three comes out as a plain STRING, including numeric-looking fields.

    • prompt, negative_prompt - the text, ready to feed into CLIPTextEncode (or NovelAIToComfyPrompt first, if the prompt is still in NAI's brace syntax).
    • seed, steps, sampler, cfg_scale - the generation settings, all as strings. If you want to wire seed into a KSampler's integer seed input, you'll need a string-to-int conversion node in between - ComfyUI won't auto-cast this for you, and that's the single most common trip-up with this node.
    • raw_metadata - the full, unparsed metadata blob. Useful as a sanity check on what the node actually read, or to grab a field it didn't bother splitting out.
    • width, height - these two actually are INT.
    • image - the loaded picture itself, passed straight through, so you can preview it or feed it onward without a second LoadImage node.

    How to install it

    Via ComfyUI Manager, search "ComfyUI NAI Prompt Converter" and install. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/raspie10032/ComfyUI_RS_NAI_Local_Prompt_converter
    

    then restart. Same pack as NovelAIToComfyPrompt and ComfyToNovelAIPrompt - install once, get all three nodes. No models, no API key, purely local file parsing.

    Common issues & troubleshooting

    Every output comes back empty. The most likely cause isn't the node - it's that the PNG has already lost its metadata before it ever reached ComfyUI. Re-saving through an editor, screenshotting instead of downloading the original, or pulling the image through a host that strips text chunks (Discord's re-encoding is a repeat offender here) will all wipe the embedded data. If raw_metadata comes back blank, there was nothing in the file to extract.

    File doesn't show up in the original_file dropdown. It has to actually be inside ComfyUI's input directory, not just somewhere on your disk. Move it there, then toggle reload_files.

    Type errors when wiring seed, steps, or cfg_scale onward. These are strings by design, not a bug - add a string-to-number conversion node before feeding them into a sampler.

    A future NovelAI export doesn't parse. This is a small, one-person-maintained pack reading a metadata format that NovelAI doesn't publish as a stable public spec. There's no evidence of it breaking, but it's worth knowing the risk exists structurally: if NovelAI ever changes how it embeds this data, a parser like this is the thing that goes stale first, and it's not going to get patched on any predictable schedule.

    Categoryprompt

    Inputs (2)

    NameTypeDefaultDescription
    original_fileCOMBOexample.png1 options: example.png
    reload_filesBOOLEANfalseβ€”

    Outputs (10)

    NameTypeDescription
    promptSTRINGβ€”
    negative_promptSTRINGβ€”
    seedSTRINGβ€”
    stepsSTRINGβ€”
    samplerSTRINGβ€”
    cfg_scaleSTRINGβ€”
    raw_metadataSTRINGβ€”
    widthINTβ€”
    heightINTβ€”
    imageIMAGEβ€”