Nodes/ComfyUI-ialhabbal/Meta Prompt Extractor
ComfyUI Node

Meta Prompt Extractor

Pull the prompt out of any PNG — even the ones you didn't make

By ialhabbal·Created 4 months ago·Updated 2 months ago· 7
Meta Prompt Extractor
  • conditioning
  • conditioning_negative
  • positive_prompt
  • negative_prompt
  • image
  • mask
  • path
  • width
  • height
  • resolution
image
use_conditioningfalse
batch_folder
batch_file_list

Every ComfyUI PNG is secretly a project file. The workflow that made it - node graph, seed, prompt - is embedded in the file's metadata as text chunks, and this node exists to crack that open and hand you the good parts: the positive and negative prompts, the image itself, its dimensions, its path. It's the "I found this image, I want its prompt" node, pointed at a file that lives anywhere on disk, with a full file browser attached.

Point it at any PNG, JPG, JPEG, WebP, or JSON file and it extracts:

  • positive_prompt / negative_prompt - the generation text, from either a ComfyUI workflow, an A1111-style parameters string, or a workflow JSON.
  • image - the image as a tensor, so you can feed it straight into img2img or a VAE.
  • mask - loaded from a matching <image>_mask.png file, or painted in with the built-in Mask Editor.
  • path, width, height, resolution - the bookkeeping.

One output node feeding an img2img pipeline with both the picture and the prompt that made it - that's the common setup.

How it finds the prompt

Straight metadata read only gets you so far. If the workflow chunk is there, it parses it; if the file carries the A1111 flat parameters block, it reads that dialect too. But workflows get complicated - prompts built by wildcard nodes, chained text, custom encoders - so when there's no clean prompt string, the node walks the graph: it finds the sampler as the anchor, follows connections backward through intermediate nodes, checks a registry of known custom nodes, and finally falls back to a smart scan that returns the most natural-language-looking result. That's the part the author is most proud of, and it's genuinely useful on messy real-world files.

The one thing it can't do is invent what was stripped. If a PNG was re-encoded by an image host, the chunks are gone and no extraction brings them back - the pixels never had the text. Keep the originals.

The inputs that matter

  • image - an absolute file path. There's a Browse button that opens the full filesystem browser: breadcrumbs, search, sorting by name/date/size/dimensions, favorites, multi-select. You can also just drag a file from your OS onto the node.
  • use_conditioning - flip this on and the optional conditioning / conditioning_negative inputs take priority over file extraction. Connect a CLIPTextEncode and it auto-turns on. This is the escape hatch when the file's metadata is useless but you have live conditioning you'd rather pass through.
  • batch_folder - a folder path; the node loads every supported image in it in one pass.
  • batch_file_list - a JSON array of exact file paths, when you want a specific subset rather than a whole folder.

Installation

It ships in the ComfyUI-ialhabbal suite, so install once and it's there. ComfyUI Manager search ComfyUI-ialhabbal, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ialhabbal/ComfyUI-ialhabbal.git

Restart, then find Meta Prompt Extractor under the utils category. It uses standard libraries - no extra model downloads.

Common issues

  • Empty prompt from a PNG - check where the file came from. Hosts like Reddit recompress and strip chunks; only files that kept their original bytes still have the workflow.
  • Won't open my folder - the browser can navigate any drive, but watch permission issues on network or system folders.
  • Prompt comes out garbled - you're probably hitting a wildcard or LLM-built workflow where the graph walk landed on a fragment. Try the conditioning override with a live CLIPTextEncode instead.
  • Batch returns nothing - double-check the paths in batch_file_list are valid JSON and the folder in batch_folder actually contains supported extensions.

For a utility node it punches above its weight: prompt recovery, batch metadata mining, and a img2img starter all in one.

Categoryutils

Inputs (6)

NameTypeDefaultDescription
imageCOMBOAbsolute path to a file. Use the Browse button.
conditioningoptCONDITIONINGOptional positive conditioning input. Connect a CLIPTextEncode (or equivalent) node here. When 'use conditioning' is ON the extracted text is forwarded to the positive_prompt output, overriding any file-based extraction.
conditioning_negativeoptCONDITIONINGOptional negative conditioning input. Connect a CLIPTextEncode (or equivalent) node here. When 'use conditioning' is ON the extracted text is forwarded to the negative_prompt output, overriding any file-based extraction.
use_conditioningoptBOOLEANfalseWhen ON: conditioning inputs take priority over file-based extraction. Turns ON automatically when a conditioning input is connected. Turn OFF to fall back to Browse Files extraction even if conditioning inputs are connected.
batch_folderoptSTRINGAbsolute or relative path to a folder containing a batch of images. When set, the node will attempt to load and process all supported images in that folder.
batch_file_listoptSTRINGJSON array (string) of file paths to use as an explicit batch. If set, these exact files will be loaded and used instead of enumerating a folder.

Outputs (8)

NameTypeDescription
positive_promptSTRING
negative_promptSTRING
imageIMAGE
maskMASK
pathSTRING
widthINT
heightINT
resolutionSTRING