Skip to main content

Overview

When ComfyUI saves an output file, it can store the workflow that produced the file inside the file itself. You can think of this as saving a generated image together with its recipe. The image is the result, and the embedded workflow describes the steps used to create it. Embedded workflow metadata allows you to:
  • Reopen a generated file in ComfyUI and recover its workflow.
  • Share a generated file together with the workflow used to create it.
  • Inspect generation settings in an automated workflow.
  • Build tools that read ComfyUI workflow metadata from output files.
The metadata is stored inside the file format. It does not change the visible image or video content.

Embedded fields

ComfyUI commonly stores two JSON fields: A simplified example looks like this:
The actual contents depend on the workflow and the ComfyUI version. Custom nodes can also add fields through extra_pnginfo. The two fields serve different purposes. workflow is intended to restore the workflow in the frontend. prompt is the execution-oriented representation used when submitting a workflow to a ComfyUI server. A file may contain one field without the other.

Supported formats

Built-in save nodes embed metadata in the following output formats: The exact metadata support depends on the save node and the file-writing path. A file that has been re-encoded by another application may no longer contain the metadata. Animated WebP files store the values in EXIF tags. The tags contain strings such as workflow:{JSON} and prompt:{JSON}. This is different from MP4 and WebM, which store the values as container metadata tags.

How ComfyUI writes metadata

Built-in output nodes receive the API prompt and additional workflow information when ComfyUI executes a workflow. Unless metadata saving is disabled, the save node serializes these values as JSON and writes them to the output file. For PNG output, the values are written as text entries. The standard field names are prompt and workflow. The metadata is not a separate sidecar file. It is written into the output file during the save operation. This means that copying the file also copies its embedded workflow, but any operation that rewrites the file may remove or replace the metadata. To disable metadata when starting ComfyUI, use:
In ComfyUI Desktop, open Settings > Server-Config and enable Disable saving prompt metadata in files. Files created while this option is enabled cannot be used to recover a workflow from embedded metadata.

How ComfyUI reads metadata

To recover a workflow in the ComfyUI interface, drag a generated file onto the canvas. You can also open a file from File > Open. If the file contains both workflow and prompt, ComfyUI uses the embedded workflow to rebuild the canvas. If the file does not contain a workflow, ComfyUI treats supported media files as regular input media. When building an integration, check for the field before parsing it. Metadata may be missing because the file was created with --disable-metadata, because the save node did not receive workflow information, or because another application re-encoded the file. For a browser-based way to inspect or edit embedded workflows, see the ComfyUI Embedded Workflow Editor. The editor is optional. You do not need it to recover a workflow in ComfyUI or read metadata programmatically.

Reading PNG metadata with Python

The following example reads the standard fields from a PNG file:
Pillow exposes PNG text chunks through Image.info. The values are JSON strings, so call json.loads before using them as Python objects.

Reading PNG metadata from the command line

You can inspect PNG text metadata with ImageMagick:
Look for the workflow and prompt text entries in the output.

Reading video metadata

ComfyUI stores workflow metadata in the container metadata for MP4 and WebM outputs. You can inspect these fields with ffprobe:
For a WebM file, use the same command with the .webm file path:
The returned tags contain JSON strings. Parse the values of the workflow and prompt tags with a JSON parser.

Reading WebP metadata

ComfyUI stores metadata for animated WebP files in EXIF tags. You can read the tags with Pillow and then parse the JSON after the field prefix:
The metadata is stored on the first image frame. If an application rewrites the WebP file, it may remove the EXIF tags.

Reading latent metadata

.latent files use the safetensors format. The metadata can be read with the safetensors Python package:
Safetensors metadata values are strings. Parse the workflow and prompt values as JSON when they are present. For any format, treat the metadata as optional and untrusted input. Validate that a value is valid JSON before using it, and do not assume that a workflow contains every model or custom node required to run it.

Limitations

  • Embedded metadata is not a digital signature. It does not prove who created or modified a file.
  • The workflow does not include the model files, input assets, or custom node packages it depends on.
  • Moving or renaming a model, input asset, or custom node can prevent a recovered workflow from running.
  • Image and video editors may remove metadata when they re-encode a file.
  • Files created with --disable-metadata do not contain the standard ComfyUI workflow metadata.