Skip to content

Detect generation data from more generators in the Output Browser and Inference - #1805

Open
deepratna-awale wants to merge 3 commits into
LykosAI:mainfrom
deepratna-awale:detect-image-generation-metadata
Open

deepratna-awale wants to merge 3 commits into
LykosAI:mainfrom
deepratna-awale:detect-image-generation-metadata

Conversation

@deepratna-awale

@deepratna-awale deepratna-awale commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1804

Problem

The Output Browser only reads generation data written by Inference and by A1111-style parameters chunks. Images from ComfyUI's Save Image node, SwarmUI, Fooocus, InvokeAI, NovelAI and others show no prompt, and the image viewer's (i) button stays disabled for them, so there's no way to tell whether an image has generation data or which tool made it. Dropping one of these images on an Inference tab fails with "File does not contain SMProject or Parameters Metadata".

Changes

Reading the metadata

  • New MetadataEntries reads the text metadata of a file without reading its image or media data:
    • PNG: tEXt, zTXt and iTXt chunks (including ones after the image data), the eXIf chunk and XMP.
    • JPEG / WEBP: the EXIF UserComment (either UTF-16 byte order, or ASCII / UTF-8), ImageDescription, Make, Model, Software, Copyright and MakerNote, JPEG comments and XMP. Values that ComfyUI save nodes label with a chunk name (prompt:{...}) and JSON objects holding chunk names (NovelAI, ComfyUI) are read like the PNG chunks they stand for.
    • MP4 / MOV / MKV / WebM: ffmpeg metadata tags, which ComfyUI and Forge use for their generation data, and XMP. Boxes and elements are walked by seeking, so large videos are not read into memory.
    • C2PA manifests (PNG caBX, JPEG APP11, WEBP C2PA, MP4 uuid).

Recognizing the format

  • New GenerationDataParser tries the formats in order of precedence and returns the format, the tool that made the file when it can be told apart, and the prompt and settings as GenerationParameters:

    Format Notes
    Stability Matrix parameters-json, and the WEBP ImageDescription
    AUTOMATIC1111 Names Stable Diffusion WebUI, Forge, Forge Classic, Forge Neo, reForge, EasyReforge, SD.Next, Civitai, Fooocus or ComfyUI from the Version / App fields and the other chunks
    ComfyUI Follows the node graph from each sampler to its prompts, model, seed, steps and CFG, including custom samplers, BasicGuider, WanVideo text embeds and values linked from primitive nodes
    InvokeAI invokeai_metadata, the legacy sd-metadata and Dream formats, and images that only carry the invokeai_graph invocation graph (for example ones re-saved by other tools): the prompt and settings are read from its core_metadata node or traced through the edges from the denoise node
    SwarmUI, Fooocus, RuinedFooocus, NovelAI, Easy Diffusion, Draw Things, TensorArt, Civitai, Hugging Face Spaces, Dezgo, KusArt Prompt, negative prompt, model and sampler settings from each tool's JSON / YAML
    C2PA / IPTC Images labelled as AI made with no generation data (ChatGPT, Gemini, Grok, Meta AI, ...), named from the C2PA software agent or the XMP publisher. Signatures are not verified.
  • The detection rules and precedence follow sd-parsers. I ran the parser over all 156 sample files in its test suite and every one gets the same format and tool name that sd-parsers expects. Reading InvokeAI images that only have the graph goes beyond sd-parsers.

  • Malformed metadata never throws: unreadable or unrecognized files return null.

Where it shows up

  • LocalImageFile.FromPath records GenerationDataSource and GenerationSoftware, and uses the parsed GenerationParameters when the existing PNG / WEBP reading found none. This also gives JPEG, GIF and video files generation data for the first time.
  • Image viewer: the (i) button is enabled for every local file. Its tooltip and the top of the info panel show Generated with and the tool (for example ComfyUI, SwarmUI, Forge Neo), or No generation data detected. The prompt and settings show below it when they could be read.
  • Output Browser: "Send to Inference" now appears for every image whose prompt could be read.
  • Inference: when a dropped or sent image has no Stability Matrix project or A1111 parameters, the prompt and settings are loaded from any other recognized format. If the format is recognized but has no prompt, the notification says which tool made the image instead of the old generic error.
  • Fixed a NullReferenceException in ImageMetadata.GetAllFileMetadata when a JPEG has no EXIF UserComment.

Screenshots

Rendered headless with the real image viewer dialog, opening images straight from output folders:

ComfyUI Save Image (the (i) button was disabled for this image before)

AUTOMATIC1111

InvokeAI (an image with only the invokeai_graph chunk)

An image without generation data

Images downloaded from CivitAI (original files from the CivitAI image feed, SFW only)

ComfyUI
SwarmUI
Forge Neo
reForge
CivitAI generator (JPEG)
Draw Things

Testing

  • New GenerationDataParserTests build PNG, JPEG and WEBP files in memory and cover: ComfyUI prompts and settings, ComfyUI JSON with NaN, seeds linked from a primitive node, A1111 parameters with tool detection, A1111 parameters next to a ComfyUI graph, SwarmUI taking precedence over a ComfyUI graph in the same file, InvokeAI, InvokeAI graph-only images (with and without a core_metadata node), NovelAI, files without generation data, XMP AI labels, UTF-16 JPEG UserComment, ComfyUI chunk-labelled EXIF values, Stability Matrix WEBP files, the A1111 version table, and LocalImageFile.FromPath.
  • Ran the parser against the 156 sd-parsers sample images and videos (PNG, JPEG, WEBP, MP4, MOV, MKV, WebM, including the ChatGPT / Gemini / Grok / Meta AI provenance samples): 156/156 match the expected format and tool.
  • Removed invokeai_metadata from the four sd-parsers InvokeAI samples and read them from invokeai_graph alone: prompt, negative prompt, model, seed, steps, CFG and scheduler match what the metadata chunk gives.
  • StabilityMatrix.Tests: all passed except the TestLicenseUrl / TestPreviewImageUri checks, which need outbound network access that my test environment blocks (unrelated to this change). StabilityMatrix.UITests: 25 passed, 1 skipped.

… Inference

Recognize the metadata formats of SwarmUI, ComfyUI (Save Image and popular
save nodes), AUTOMATIC1111 and its forks, Fooocus, RuinedFooocus, InvokeAI,
NovelAI, Easy Diffusion, Draw Things, TensorArt, Civitai, Hugging Face
Spaces, Dezgo, KusArt and Stability Matrix in PNG, JPEG, WEBP, MP4, MOV,
MKV and WebM files, plus C2PA and IPTC AI labels.

The image viewer info button is always enabled for local files and shows
which tool made the image, or that no generation data was found. Inference
loads the prompt and settings of any recognized format when an image is
dropped or sent to it.
@deepratna-awale
deepratna-awale marked this pull request as ready for review November 19, 2026 01:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output Browser and Inference don't recognize generation data from ComfyUI Save Image, SwarmUI and other generators

1 participant