📝 LMM Extract Prompts
Reconstruct the prompt behind a whole folder of images, LoRA tags stripped
- paths
- positive_prompt
- negative_prompt
- info
If you've ever looked at a folder of PNGs and wanted to know what each one was generated with, this is the node that turns that pile into usable text. The 📝 LMM Extract Prompts node talks to Local Media Manager - Firetheft's ComfyUI extension that lists the images in a directory - takes its paths output, and pulls the positive prompt, negative prompt, and generation info out of each image's embedded metadata. It's a batch metadata scraper with one specific, sensible rule set.
How it works
The only input is paths (LMM_ALL_PATHS), which you connect from Local Media Manager's paths output - the node won't work standalone, and that's by design; it's an adapter for LMM, not a file browser. For each image in the list it reads the metadata, and the interesting part is how it splits it:
- positive_prompt - the positive prompt with every
<lora:...>tag removed. - negative_prompt - same treatment.
- info - the inverse: it keeps only the
<lora:...>tags plus everything fromSteps:onward (sampler, steps, cfg, seed, model, hashes...). That's the Civitai-style generation block, LoRAs included.
So you get clean, reusable prompts on one side and the machine-parseable generation record on the other - a deliberate split, not an accident. Multi-selection works: select several images and the prompts concatenate across them (non-image items are ignored).
When you'd use it
The classic flow is reconstruction-after-the-fact: you've got a batch of images (someone else's or your own from before you started tracking workflows) and you want to feed the recovered prompts back into a generation or LoRA-training session. Pair the positive_prompt/negative_prompt outputs with a text-input node, and wire info into a metadata saver if you want to re-embed the generation block.
The parsing engine is also robust in a way worth noting: it handles both the A1111-style parameters text chunk and ComfyUI's embedded JSON workflow (it walks the graph to find the CLIPTextEncode nodes that feed a sampler), so it copes with images from both lineages.
Caveats
- It's only as good as the metadata in the files. Screenshots, re-encoded JPEGs, and web downloads have nothing to read - you'll get empty strings, not errors.
- This node requires the Local Media Manager pack installed and in your graph; it's an integration piece, not a standalone prompt reader. If you don't use LMM, you're better off with a plain metadata loader.
- The LoRA-stripping is regex-based on the
<lora:...>pattern, so nonstandard tag formats may survive into the prompt output.
Install
Install Light-x02 Nodes plus ComfyUI_Local_Media_Manager (both via ComfyUI Manager, or git clone into custom_nodes):
cd ComfyUI/custom_nodes
git clone https://github.com/Light-x02/ComfyUI-Lightx02-Nodes
git clone https://github.com/Firetheft/ComfyUI_Local_Media_Manager
Restart ComfyUI. The Light-x02 side has no extra dependencies beyond Pillow, which ComfyUI already ships.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| paths | LMM_ALL_PATHS | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive_prompt | STRING | — |
| negative_prompt | STRING | — |
| info | STRING | — |