ComfyUI Node

Save Image With Prompt/Metadata

Save Image With Prompt/Metadata

By DropFan·Created 2 years ago·Updated about a year ago· 5
Save Image With Prompt/Metadata
  • image
  • Metadata RAW
output_dir2026-08-25
filename_prefixPortrait
with_workflowfalse
metadata_extra{ "Title": "Image generated by PortraitMasterCN", "Description": "More info: https:\/\/github.com\/DropFan", "Author": "PortraitMasterCN", "Software": "ComfyUI", "Category": "StableDiffusion", "Rating": 5, "UserComment": "", "Keywords": [ "AIGC", "StableDiffusion", "ComfyUI", "Portrait" ], "Copyrights": "" }
prompt_text
negative_prompt_text

The least glamorous node in this pack is the one you'll thank yourself for installing. ComfyUI already embeds the workflow graph in your PNGs - drag one back onto the canvas and the whole pipeline rebuilds. What it does not save by default is the actual prompt text as something human-readable, and if you batch-generate hundreds of portraits, you end up with a folder of Portrait_00001.png files you can't tell apart. PortraitMasterImageSaver (Save Image With Prompt/Metadata) fixes exactly that: a drop-in SaveImage replacement that writes your positive and negative prompts plus custom metadata into the file's EXIF.

It's the odd one out in comfyui-portrait-master-cn - the pack is otherwise a prompt-builder, and this node is the fork author's own addition, adapted from ComfyUI-Crystools. "Modified by Tiger," says the header, and it works.

How it works

Under the hood it subclasses ComfyUI's own SaveImage, so everything the core node does, it does. On top of that:

  • prompt_text and negative_prompt_text (multiline STRINGs) get merged into the image's extra_pnginfo and written to the file - via piexif, which ComfyUI bundles, so there's no extra install.
  • metadata_extra (optional) is a JSON block you can edit - title, author, keywords, copyright. It's parsed and merged into the metadata; if the JSON is malformed it silently falls back to storing the raw string. That default is the pack's own branding ("Title": "Image generated by PortraitMasterCN"), and you'll probably want to swap the Author to your own name.
  • with_workflow (default off) controls whether the full workflow graph is embedded. Turn it on and the file carries both the human-readable prompt and the re-runnable graph.

The output_dir string is a subfolder under ComfyUI/output (defaults to today's date) and filename_prefix is the file stem.

The input that matters

  • image (required) - wire from your VAE decode.
  • prompt_text / negative_prompt_text - wire straight from Portrait Master's text_out, or from the legacy node's positive/negative outputs. This is the whole point: the prompt rides along with the pixels.

The output

It returns Metadata RAW (a METADATA_RAW type), which feeds nodes that read metadata - handy if you want to chain a metadata viewer or re-inject the prompt elsewhere. It's an output node, so it's the end of the line.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/DropFan/comfyui-portrait-master-cn

Restart ComfyUI, or search comfyui-portrait-master-cn in ComfyUI Manager. The piexif dependency ships with ComfyUI itself, so this is a no-extra-install node.

Where people get burned

  • EXIF survives, but not through re-encoding. The metadata lives in the file as written. Recompress the image, convert PNG→JPEG in an editor that strips EXIF, or upload to a host that re-processes, and the prompt is gone - same trap as every metadata convention, and worth knowing before you share "workflow included" files.
  • The default metadata is the author's brand, not yours. That JSON in metadata_extra says "Image generated by PortraitMasterCN." Change Author before you ship a batch.
  • Malformed JSON is silently eaten - the node logs an error and stores the string as-is rather than crashing. If your keywords stop showing up, check the JSON, not the node.

The honest take

It's boring on purpose. Every Portrait Master workflow should end in this node instead of stock SaveImage, because a portrait you can't find in your own output folder is a portrait you don't have. Five minutes to wire, forever payoff when you're hunting for "the one with the blue dress" in a folder of 800 PNGs.

Category肖像大师中文版 Portrait Master CN

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
output_dirSTRING2026-08-25
filename_prefixSTRINGPortrait
with_workflowBOOLEANfalse
metadata_extraoptSTRING{ "Title": "Image generated by PortraitMasterCN", "Description": "More info: https:\/\/github.com\/DropFan", "Author": "PortraitMasterCN", "Software": "ComfyUI", "Category": "StableDiffusion", "Rating": 5, "UserComment": "", "Keywords": [ "AIGC", "StableDiffusion", "ComfyUI", "Portrait" ], "Copyrights": "" }
prompt_textoptSTRING
negative_prompt_textoptSTRING

Outputs (1)

NameTypeDescription
Metadata RAWMETADATA_RAW