sd-parse
Read the prompts and generation settings embedded in images made with Stable Diffusion and other AI image tools.
This is the Python release of sd-parsers, published with the same version numbers as the npm package and giving the same results for every image. It does not "predict" anything: images must already carry their generation data.
Website: https://sd-parsers.vercel.app/ (drop an image to read its metadata in your browser).
Installation
pip install sd-parse
Requires Python 3.10 or newer and has no dependencies. Stealth metadata hidden in the PNG alpha channel is read with Pillow, which comes with the stealth extra:
pip install "sd-parse[stealth]"
Supported tools
AUTOMATIC1111 and the tools that write its format (Forge, Forge Classic, Forge Neo, reForge, SD.Next, CivitAI), Fooocus, ComfyUI (including JPEG / WEBP save nodes and popular node packs), InvokeAI, NovelAI, SwarmUI, Easy Diffusion, Draw Things, RuinedFooocus, Stability Matrix, TensorArt, CivitAI node graphs, Hugging Face Spaces, Dezgo and KusArt. Images from ChatGPT, Gemini, Grok Imagine, Meta AI and other services that label them with C2PA manifests or an IPTC digital source type are reported with the service's name.
Metadata is read from PNG text chunks, JPEG / WEBP EXIF, comments and XMP, MP4 / MOV / WebM / MKV video tags, and the PNG alpha channel. Only the metadata is read, so the image is never decoded (except for stealth metadata).
Command line
sd-parse image1.png image2.jpg # models, samplers, prompts and other metadata
sd-parse --json image1.png | jq '.[0].full_prompt'
sd-parse --infotext comfyui.png # AUTOMATIC1111 style text, ready to paste
sd-parse strip image.png -o clean.png # remove all metadata
sd-parse copy original.png edited.jpg -o edited.jpg
sd-parse to-a1111 comfyui.png -o comfyui.png
sd-parse diff first.png second.png # settings, prompt tokens and LoRAs that differ
sd-parse stats outputs/*.png # software, models, samplers, sizes, LoRAs and tags
python -m sd_parse works too. Add --eager to read stealth metadata (needs Pillow). The command exits with 1 when any file can't be read.
Usage
from sd_parse import ParserManager
prompt_info = ParserManager().parse("image.png")
if prompt_info:
print(prompt_info.generator, prompt_info.software)
print(prompt_info.full_prompt)
print(prompt_info.full_negative_prompt)
for model in prompt_info.models:
print(model.name, model.hash)
for sampler in prompt_info.samplers:
print(sampler.name, sampler.parameters)
parse() takes a file path, the file contents as bytes, or a binary file object (also non-seekable streams, of which only the metadata is read). It returns a PromptInfo, or None when no known metadata is found. Pass eagerness=Eagerness.EAGER to ParserManager to also look for stealth metadata.
Output
prompt_info_to_dict() and prompt_info_to_json() give the same JSON as the npm package and the --json option (full_prompt, samplers, negativePrompts, rawParameters and so on):
from sd_parse import prompt_info_to_json
print(prompt_info_to_json(prompt_info, indent=2))
Helpers
from sd_parse import (
get_generation_settings, # model, sampler, steps, CFG scale, seed, size, LoRAs and prompts as plain values
get_loras, # LoRAs with their weights and hashes
to_infotext, # the generation data as AUTOMATIC1111 text
compare_metadata, # what differs between two images
analyze_collection, # a summary of many images
parse_prompt_tokens, # a prompt split into weighted tokens
read_provenance, # C2PA and XMP labels of AI made images
)
Writing metadata
from sd_parse import copy_metadata, strip_metadata, to_infotext, write_metadata
with open("image.png", "rb") as file:
image = file.read()
clean = strip_metadata(image)
a1111 = write_metadata(image, to_infotext(prompt_info))
edited = copy_metadata(image, edited_jpeg_bytes)
PNG, JPEG and WEBP images are supported.
License
MIT
Metadata
Release files for sd-parse 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sd_parse-1.3.2.tar.gz | 68.4 kB | With provenance | Details for sd_parse-1.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sd_parse-1.3.2-py3-none-any.whl | Python 3 | none | any | Details for sd_parse-1.3.2-py3-none-any.whl |
Total release size: 149.4 kB
Release files / sd_parse-1.3.2.tar.gz
| Download URL | sd_parse-1.3.2.tar.gz |
|---|---|
| Size | 68.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f1a00ebbf257863f48b65b061aff52557db7095112bc6eab7b983abd87c06dc
|
|
BLAKE2b-256 checksum How to use checksums |
98d6d0e77d6f874f9eb5155ff71689e2a024267729cac5befaa1a75c3ad73d9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / sd_parse-1.3.2-py3-none-any.whl
| Download URL | sd_parse-1.3.2-py3-none-any.whl |
|---|---|
| Size | 81.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b2fd5136bded2a59792be04e994d6efd67208bba746f55f61dba08bef34f678
|
|
BLAKE2b-256 checksum How to use checksums |
1f6353c37df119285c91eb15c0fc734857fdcb8fdb9070ef956be106cf2b0bee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for sd-parse 1.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sd_parse-1.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.