Documentation
¶
Overview ¶
Package metadata provides high-level functions to extract image generation parameters from image files.
This supports multiple sources, including Fooocus, FooocusPlus and RuinedFooocus.
Example usage:
To read metadata, first register the sources you want to enable by importing the appropriate package:
import ( _ "github.com/fkleon/fooocus-metadata/fooocus" )
To read metadata from a file, use ExtractFromFile:
path := "fooocus/testdata/fooocus-meta.png" meta, err := ExtractFromFile(path) fmt.Println(meta.Version) // prints "Fooocus v2.5.5"
To read metadata from a stream, use ExtractFromReader. You can provide a hint about the original filepath to enable path-based features such as sidecar support:
path := "fooocus/testdata/fooocus-meta.png" file, err := os.Open(path) defer file.Close() meta, err := ExtractFromReader(file, WithPath(path)) fmt.Println(meta.Version) // prints "Fooocus v2.5.5"
To write metadata, use the individual metadata writers provided by each package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractFromFile ¶
func ExtractFromFile(path string) (params types.StructuredMetadata, err error)
func ExtractFromReader ¶
func ExtractFromReader(reader io.ReadSeeker, opts ...Option) (params types.StructuredMetadata, err error)
Types ¶
type ExtractOptions ¶
type ExtractOptions struct {
// The path of the file to read image metadata from.
File string
}
ExtractOptions contains the options for the Extract function.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
embed
command
A command-line tool to embed image generation parameters into an image file.
|
A command-line tool to embed image generation parameters into an image file. |
|
extract
command
A command-line tool to extract image generation parameters from an image file or sidecar file.
|
A command-line tool to extract image generation parameters from an image file or sidecar file. |
|
Package fooocus implements reading and writing Fooocus metadata (image generation parameters).
|
Package fooocus implements reading and writing Fooocus metadata (image generation parameters). |
|
Package fooocusplus implements reading and writing [FooocusPlus] metadata (image generation parameters).
|
Package fooocusplus implements reading and writing [FooocusPlus] metadata (image generation parameters). |
|
internal
|
|
|
image
Package image provides utilities to detect image MIME types and read embedded image metadata (EXIF or PNG tEXt).
|
Package image provides utilities to detect image MIME types and read embedded image metadata (EXIF or PNG tEXt). |
|
Package ruinedfooocus implements reading and writing [RuinedFooocus] metadata (image generation parameters).
|
Package ruinedfooocus implements reading and writing [RuinedFooocus] metadata (image generation parameters). |
|
Package stablediffusion implements reading [AUTOMATIC1111] style plaintext metadata (image generation parameters).
|
Package stablediffusion implements reading [AUTOMATIC1111] style plaintext metadata (image generation parameters). |
|
Package types contains common interface definitions and the type registry for reading metadata.
|
Package types contains common interface definitions and the type registry for reading metadata. |