Nodes/ComfyUI-Prompt-Manager/Prompt Extractor
ComfyUI Node

Prompt Extractor

Steal your own workflows back from an old PNG

By FranckyB·Created 10 months ago·Updated 8 days ago· 147
Prompt Extractor
  • lora_stack_a
  • lora_stack_b
  • video
  • positive_prompt
  • negative_prompt
  • lora_stack_a
  • lora_stack_b
  • image
source_folderinput
image
frame_position0.00
use_lora_input_onlyfalse

Every image generated in ComfyUI, A1111, or Forge carries its generation metadata in the file itself - the prompt, negative prompt, models, even the LoRAs. Prompt Extractor (class PromptExtractor) is the tool that digs that metadata back out and hands it to your graph as typed outputs. It's the "I generated this two weeks ago and want to rerun it" node, and it's also a sneaky-good advanced image loader.

How it works

You pick a source_folder (input or output - ComfyUI's input and output directories), choose an image from the dropdown, and the node reads the embedded workflow metadata. It parses ComfyUI's embedded JSON, A1111/Forge PNG info chunks, and WebP metadata, and it supports Wan workflows with their dual model/stack setup. For videos it can read the first frame via frame_position (0.0–1.0, default 0), which is how you pull generation data back out of a video file. Then it outputs:

  • positive_prompt and negative_prompt - straight from metadata
  • lora_stack_a and lora_stack_b - the LoRA stacks, rebuilt into standard LORA_STACK wires
  • image - the file itself as an IMAGE tensor

That last output is why it doubles as a media loader: drag in any file, and it loads both the image and its generation settings at once. Connect the outputs to your prompt and LoRA inputs and you've reconstructed the run, ready to tweak.

The inputs that matter

  • source_folder - input or output. The dropdown for image is populated from whichever you pick.
  • frame_position - video extraction; 0 is the first frame, 1 is the last.
  • use_lora_input_only - when on, it skips LoRA extraction and uses only whatever LORA_STACK you connect to the optional lora_stack_a / lora_stack_b inputs. Handy when you know the file's LoRAs are stale and you want to substitute your own.

Wiring and install

Route positive_prompt into your positive text input, lora_stack_a/b into your loader (or into a Prompt Manager node, which accepts both stack types), and reuse image if you want to feed the original into an img2img or ControlNet path. It's part of the pack, so install once:

cd ComfyUI/custom_nodes
git clone https://github.com/FranckyB/ComfyUI-Prompt-Manager.git
cd ComfyUI-Prompt-Manager
pip install -r requirements.txt

Or search "Prompt Manager" in ComfyUI Manager, then restart.

Where people get burned

The big one: not every image has metadata worth reading. Screenshots, web-downloaded PNGs, and anything re-encoded has none, and the dropdown will happily show the file while the prompt outputs come back empty. Files generated in A1111 extract cleanly, but the LoRA output depends on the file actually recording LoRA data - some A1111 setups only write the trigger-word prompt text, not structured LoRA entries, so check what you get. If use_lora_input_only is off and a workflow has no LoRA metadata, the stack outputs are simply empty; feed them into a loader expecting a stack and it just means "no LoRAs." And if you're extracting from videos, note that frame_position picks one frame - the metadata you're after is the generation metadata, which is the same for the whole clip, so any frame works.

CategoryPrompt Manager

Inputs (7)

NameTypeDefaultDescription
source_folderCOMBOinputBrowse files from the input or output folder
imageCOMBO2 options: (none), example.png
frame_positionFLOAT0.000–1
use_lora_input_onlyBOOLEANfalseWhen enabled, skip LoRA extraction and use only connected LoRA inputs
lora_stack_aoptLORA_STACK
lora_stack_boptLORA_STACK
videooptVIDEOOptional video input. When connected, extract from this video directly and the file picker is ignored.

Outputs (5)

NameTypeDescription
positive_promptSTRING
negative_promptSTRING
lora_stack_aLORA_STACK
lora_stack_bLORA_STACK
imageIMAGE