Home

Awesome

<div align="center"> <img alt="icon" src="https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/sd_prompt_reader/resources/icon-cube.png" width=20% height=20%> <h1>Stable Diffusion Prompt Reader</h1> <a href="https://github.com/receyuki/stable-diffusion-prompt-reader/releases/latest"> <img alt="GitHub releases" src="https://img.shields.io/github/downloads/receyuki/stable-diffusion-prompt-reader/total"></a> <a href="https://github.com/receyuki/stable-diffusion-prompt-reader/blob/master/LICENSE"> <img alt="GitHub" src="https://img.shields.io/github/license/receyuki/stable-diffusion-prompt-reader"></a> <a href="https://github.com/receyuki/stable-diffusion-prompt-reader/releases/latest"> <img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/receyuki/stable-diffusion-prompt-reader"></a> <a href="https://pypi.org/project/sd-prompt-reader/"> <img alt="PyPI" src="https://img.shields.io/pypi/v/sd-prompt-reader"></a> <a href="https://github.com/psf/black"> <img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> <img alt="platform" src="https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey"> <br><br>

简体中文 | English

A simple standalone viewer for reading prompt from Stable Diffusion generated image outside the webui. <br>

<p> <a href="#features">Features</a> • <a href="#supported-formats">Supported Formats</a> • <a href="#download">Download</a> • <a href="#usage">Usage</a> • <a href="#cli">CLI</a> • <a href="https://github.com/receyuki/comfyui-prompt-reader-node">ComfyUI Node</a> • <a href="#faq">FAQ</a> • <a href="#credits">Credits</a> </p> <img src="https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/images/screenshot_v134.png"> </div>

[!TIP] The SD Prompt Reader is now available as a ComfyUI node. Check out the ComfyUI Prompt Reader Node for more information.

Features

Supported Formats

PNGJPEGWEBPTXT*
A1111's webUI
Easy Diffusion
StableSwarmUI*
StableSwarmUI (prior to 0.5.8-alpha)*
Fooocus-MRE*
NovelAI (stealth pnginfo)
NovelAI (legacy)
InvokeAI
InvokeAI (prior to 2.3.5-post.2)
InvokeAI (prior to 1.15)
ComfyUI*
Draw Things
Naifu(4chan)

* Limitations apply. See format limitations.

[!NOTE] If you are using a tool or format that is not on this list, please help me to support your format by uploading the original file generated by your tool to the issues, thx.

[!TIP] For ComfyUI users, the SD Prompt Reader is now available as a ComfyUI node. The ComfyUI Prompt Reader Node is a subproject of this project, and it is recommended to embed the Prompt Saver node in the ComfyUI Prompt Reader Node within your workflow to ensure maximum compatibility.

Download

For Windows users

Download executable from GitHub Releases

For macOS users

Download executable from GitHub Releases

Install via Homebrew Cask

You may also install SD Prompt Reader via Homebrew cask.

brew install --no-quarantine receyuki/sd-prompt-reader/sd-prompt-reader

The parameter --no-quarantine is used since the SD Prompt Reader is currently unsigned as I mentioned here

For Linux users (not regularly tested)

I'm pretty sure linux users can figure things out without an executable.

You can choose to install with pip or run it manually

Install with pip or pipx

pip install sd-prompt-reader

or

pipx install sd-prompt-reader

To launch the GUI just enter sd-prompt-reader in the terminal.
For the CLI, please use sd-prompt-reader-cli.

Run source code manually

  1. Clone this repo.
    git clone https://github.com/receyuki/stable-diffusion-prompt-reader.git
    
    or download repo as a zip.
  2. CD to the directory and install dependencies.
    cd stable-diffusion-prompt-reader  
    pip install -r requirements.txt
    
  3. Run.
    python -m sd_prompt_reader.app
    

Usage

Read prompt

OR

OR

Export prompt to a text file

Remove prompt from image

Edit image

[!NOTE] The edited image will be written in A1111 format, meaning that image in any format will become A1111 format after editing.

Copy as single line prompt

Copy image prompt and setting in a format that can be read by Prompts from file or textbox The following parameters are supported:

SettingParameter
Seed--seed
Variation seed strength--subseed_strength
Seed resize from--seed_resize_from_h
Seed resize from--seed_resize_from_w
Sampler--sampler_name
Steps--steps
CFG scale--cfg_scale
Size--width
Size--height
Face restoration--restore_faces

ComfyUI SDXL workflow

[!NOTE] The SDXL workflow does not support editing. If necessary, please remove prompts from image before edit.

If the image's workflow includes multiple sets of SDXL prompts, namely Clip G(text_g), Clip L(text_l), and Refiner, the SD Prompt Reader will switch to the multi-set prompt display mode as shown in the image below. There are two interface options available for the multi-set prompt display mode, and you can switch between them using buttons.
comfyui_sdxl.png

CLI

A CLI tool for reading, modifying, and clearing metadata is provided.

Platforms

For Windows users

SD Prompt Reader CLI.exe will be placed in the zip package as a separate executable.
Examples: "SD Prompt Reader CLI.exe" -i example.png

For macOS users

The executable is located at SD Prompt Reader.app/Contents/MacOS/SD Prompt Reader.
Examples: /Applications/SD\ Prompt\ Reader.app/Contents/MacOS/SD\ Prompt\ Reader -i example.png

For pip users

Examples: sd-prompt-reader-cli -i example.png

Modes and Options

Modes

General Options

Read Options

Write Options

Basic Usage

Read Mode

Write Mode

Clear Mode

Format Limitations

TXT

  1. Importing txt file is only allowed in edit mode.
  2. Only A1111 format txt files are supported. You can use txt files generated by the A1111 webui or use the SD prompt reader to export txt from A1111 images

StableSwarmUI

[!IMPORTANT] StableSwarmUI is still in the Alpha testing phase, and its format may change in the future. I will keep track of upcoming updates of StableSwarmUI.

ComfyUI

[!IMPORTANT] When custom nodes are used or when the workflow becomes overly complex, there is a high probability that metadata may not be correctly read. This is because ComfyUI does not store metadata but only the complete workflow. SD Prompt Reader can only handle basic workflows. It is recommended to embed the Prompt Saver node in the ComfyUI Prompt Reader Node within your workflow to ensure maximum compatibility.

  1. If there are multiple sets of data (seed, steps, CFG, etc.) in the setting box, this means that there are multiple KSampler nodes in the flowchart.
  2. Due to the nature of ComfyUI, all nodes and flowcharts in the workflow are stored in the image, including those that are not being used. Also, a flowchart can have multiple branches, inputs and outputs. (e.g. output hires. fixed image and original image simultaneously in a single flowchart) SD Prompt Reader will traverse all flowcharts and branches and display the longest branch with complete input and output.
  3. ComfyUI SDXL workflow

Easy Diffusion

By default, Easy Diffusion does not write metadata to images. Please change the Metadata format in settings to embed to write the metadata to images

Fooocus-MRE

Since the original version of Fooocus does not support writing metadata to image files, SD Prompt Reader only supports images generated by Fooocus MoonRide Edition.

FAQ

Malware Alert

[!WARNING] The false positive reported by some anti-malwares is caused by the packaging tool pyinstaller which is a common issue for pyinstaller users. I spent a lot of time trying to fix the Windows Defender false positive before, but I couldn't do it for every antivirus software. So, you can either trust Windows Defender or use the instruction for Linux users to use this app.

"SD Prompt Reader.app" is damaged and can't be opened. You should move it to the Trash

[!IMPORTANT] This is a very common macOS issue when you run unsigned non-appstore apps, and developers must pay $99 per year to Apple to eliminate this issue. You can choose to Allow Apps from Anywhere in security & privacy settings which can be dangerous. The way I prefer is to remove the quarantine attributes.

  1. Open Terminal from the Applications folder.

  2. Type in the following command and hit Enter.

    xattr -r -d com.apple.quarantine /path/to/app.app

    In my case it's

    xattr -r -d com.apple.quarantine /Applications/SD\ Prompt\ Reader.app

If you are still concerned about the security of the app you can use the instruction for Linux users to use this app.

TODO

Credits