Extracts Draw Things and A1111 prompts to txt files cfrom PNG files in a specified path, useful for captioning
Project description
prompt2txt
A tool for extracting Draw Things and Automatic1111 (A1111) prompts from PNG files and saving them as corresponding text files.
Use Case
You have a large number of rendered PNG images created with Automatic1111 or Draw Things and need to extract the embedded prompts from them.
Installation
Using pip
pip install prompt2txt
From Source
-
Clone the repository:
git clone https://github.com/yourusername/prompt2txt.git cd prompt2txt
-
Install using Poetry:
poetry install
Usage
Command Line
# Using the installed package
prompt2txt /path/to/image/folder/
# Using Poetry in the project directory
poetry run prompt2txt /path/to/image/folder/
Python API
from prompt2txt import PromptExtractor
extractor = PromptExtractor()
extractor.process_directory("/path/to/image/folder/")
Features
- Extracts prompts from both Draw Things and Automatic1111 generated images
- Processes images in parallel for faster extraction
- Creates text files with the same name as the original PNG files
- Cleans and formats the extracted prompts
Requirements
- Python 3.8+
- Dependencies (automatically installed):
- Pillow
- tqdm
Caveats
- Automatic1111 may require enabling the "Save metadata to images" option to embed usable metadata.
- Some images may not contain extractable prompt data.
Development
This project uses Poetry for dependency management and packaging:
# Install development dependencies
poetry install
# Run tests
poetry run pytest
# Build the package
poetry build
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prompt2txt-0.2.0.tar.gz.
File metadata
- Download URL: prompt2txt-0.2.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547745d39236229ee735b1f014477370d822dd08650c14ac11becd9e1b606d68
|
|
| MD5 |
21d8e856be2b54b421c1d80a17307241
|
|
| BLAKE2b-256 |
138c02f6ae780917814c739961054bffa5a5007806ddd92e87e4fcc144831b4b
|
File details
Details for the file prompt2txt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: prompt2txt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e031437e0cc3044c99ab1a955b0ebffca9bd31af1bc932ee149df42b8e345ebe
|
|
| MD5 |
37e3b79106d2ce9519eb38a9c4ebdc15
|
|
| BLAKE2b-256 |
fe7da89b8a73a2f354b37b72029102854f96009dbac0e649ac19f8d62fc972fd
|