https://github.com/fkleon/fooocus-metadata
A go package for reading and writing Fooocus metadata
https://github.com/fkleon/fooocus-metadata
Last synced: 6 months ago
JSON representation
A go package for reading and writing Fooocus metadata
- Host: GitHub
- URL: https://github.com/fkleon/fooocus-metadata
- Owner: fkleon
- License: agpl-3.0
- Created: 2025-04-11T11:59:55.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-06T09:46:51.000Z (10 months ago)
- Last Synced: 2025-10-13T00:29:32.864Z (9 months ago)
- Language: Go
- Size: 4.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `fooocus-metadata`
A Go library for reading and writing image generation parameters for images produced by [Fooocus and various forks](#compatibility).
## Features
- Read embedded metadata (PNG, EXIF) for image files generated by Fooocus.
- Read metadata from the [Private Log file](https://github.com/lllyasviel/Fooocus/discussions/160) as fallback if metadata was not embedded into the original file.
- Write metadata to PNG, which can be loaded into Fooocus through `Input Image > Metadata`.
## Usage
This library is intended to be used programmatically. It includes a [command line tool](./cmd/extract/main.go) to read metadata from a file, which serves as a usage example.
## Compatibility
### [Fooocus]
Tested with Fooocus version 2.1 and newer.
Fooocus supports two metadata schemes:
- `fooocus` (json) - the native scheme.
- `a1111` (plain text) - for compatibility with Civitai.
This library fully supports the native `fooocus` scheme.
Partial support for reading the `a1111` scheme is provided by the generic A1111-style metadata parser, but it does not support any Fooocus-specific keys.
| Image Format | Metadata Location | Metadata Scheme | Read | Write |
|----------------|------------------------|-----------------|------|-------|
| PNG | Embedded | `fooocus` | ✅ | ✅ |
| JPG, WEBP | Embedded | `fooocus` | ✅ | ❌ |
| * | Embedded | `a1111` | ⚠️ | ❌ |
| PNG, JPG, WEBP | External (Private Log) | `fooocus` | ✅ | ❌ |
### [FooocusPlus]
Tested with FooocusPlus version 1.0.0 and newer.
| Image Format | Metadata Location | Metadata Scheme | Read | Write |
|----------------|------------------------|-----------------|------|-------|
| PNG | Embedded | JSON | ✅ | ✅ |
| JPG, WEBP | Embedded | JSON | ✅ | ❌ |
| PNG, JPG, WEBP | External (Private Log) | JSON | ✅ | ❌ |
### [RuinedFooocus]
Tested with RuinedFooocus version 2.0.0 and newer.
| Image Format | Metadata Location | Metadata Scheme | Read | Write |
|--------------|-------------------|-----------------|------|-------|
| PNG | Embedded | JSON | ✅ | ✅ |
### AUTOMATIC1111-style metadata
Basic read-only support for metadata encoded in `a1111` (plain text) format. Unsupported keys are ignored.
Tested with:
* [stable-diffusion-webui]
* [stable-diffusion.cpp]
| Image Format | Metadata Location | Metadata Scheme | Read | Write |
|-----------------|-------------------|-----------------|------|-------|
| PNG, JPEG, WEBP | Embedded | `a1111` | ✅ | ❌ |
[Fooocus]: https://github.com/lllyasviel/Fooocus
[FooocusPlus]: https://github.com/DavidDragonsage/FooocusPlus
[RuinedFooocus]: https://github.com/runew0lf/RuinedFooocus
[stable-diffusion.cpp]: https://github.com/leejet/stable-diffusion.cpp
[stable-diffusion-webui]: https://github.com/AUTOMATIC1111/stable-diffusion-webui