Repository navigation
Detect generation data from more generators in the Output Browser and Inference - #1805
Open
deepratna-awale wants to merge 3 commits into
Open
deepratna-awale wants to merge 3 commits into
deepratna-awale wants to merge 3 commits into
Conversation
… 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
marked this pull request as ready for review
November 19, 2026 01:17
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1804
Problem
The Output Browser only reads generation data written by Inference and by A1111-style
parameterschunks. 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
MetadataEntriesreads the text metadata of a file without reading its image or media data:tEXt,zTXtandiTXtchunks (including ones after the image data), theeXIfchunk and XMP.UserComment(either UTF-16 byte order, or ASCII / UTF-8),ImageDescription,Make,Model,Software,CopyrightandMakerNote, 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.caBX, JPEG APP11, WEBPC2PA, MP4uuid).Recognizing the format
New
GenerationDataParsertries 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 asGenerationParameters:parameters-json, and the WEBPImageDescriptionVersion/Appfields and the other chunksBasicGuider, WanVideo text embeds and values linked from primitive nodesinvokeai_metadata, the legacysd-metadataandDreamformats, and images that only carry theinvokeai_graphinvocation graph (for example ones re-saved by other tools): the prompt and settings are read from itscore_metadatanode or traced through the edges from the denoise nodeThe 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.FromPathrecordsGenerationDataSourceandGenerationSoftware, and uses the parsedGenerationParameterswhen the existing PNG / WEBP reading found none. This also gives JPEG, GIF and video files generation data for the first time.(i)button is enabled for every local file. Its tooltip and the top of the info panel show Generated with and the tool (for exampleComfyUI,SwarmUI,Forge Neo), or No generation data detected. The prompt and settings show below it when they could be read.NullReferenceExceptioninImageMetadata.GetAllFileMetadatawhen a JPEG has no EXIFUserComment.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_graphchunk)An image without generation data
Images downloaded from CivitAI (original files from the CivitAI image feed, SFW only)
Testing
GenerationDataParserTestsbuild PNG, JPEG and WEBP files in memory and cover: ComfyUI prompts and settings, ComfyUI JSON withNaN, 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 acore_metadatanode), NovelAI, files without generation data, XMP AI labels, UTF-16 JPEGUserComment, ComfyUI chunk-labelled EXIF values, Stability Matrix WEBP files, the A1111 version table, andLocalImageFile.FromPath.invokeai_metadatafrom the four sd-parsers InvokeAI samples and read them frominvokeai_graphalone: prompt, negative prompt, model, seed, steps, CFG and scheduler match what the metadata chunk gives.StabilityMatrix.Tests: all passed except theTestLicenseUrl/TestPreviewImageUrichecks, which need outbound network access that my test environment blocks (unrelated to this change).StabilityMatrix.UITests: 25 passed, 1 skipped.