An open API service indexing awesome lists of open source software.

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

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