1.0.13 • Published 8 months ago

stable-diffusion-image-metadata v1.0.13

Weekly downloads
-
License
MPL-2.0
Repository
github
Last release
8 months ago

stable-diffusion-image-metadata

This tool provides the capability to extract and parse metadata from images. It is inspired by the work of the civitai project and leverages some of their code for image metadata parses

About for the processing of parameters, there are two steps.

  • (1) Preprocessing, which extracts special attributes in a 'RegExp'
  • (2) Extracting the primary attributes with 'split(': ') and split(', ')'

Installation

npm install --save stable-diffusion-image-metadata

Dependencies

{
  "exifreader": "^4.13.0"
}

Usage

export { extract, parse, stringify } from 'stable-diffusion-image-metadata';

const image = 'https://image.png'; // or File | base64

const [parameters, isParameters] = await extract(image);

const metadata = parse(parameters);

const metadataStr = stringify(metadata);

Changelog

1.0.11 - 2023-09-09

  • fixed parse: make preprocess config, there will already be more preprocessing configs in the future.
const preproccessConfigs = [
  { reg: /(ControlNet \d+): "([^"]+)"/g },
  { reg: /(Lora hashes): "([^"]+)"/g },
  { reg: /(Hashes): ({[^}]+})/g, key: 'hashes', value: preproccessFormatJSONValueFn },
  //...There should be many configs that need to be preprocessed in the future
];

1.0.10 - 2023-09-09

  • remove 'buffer-big-endian.ts'
  • fixed function 'extract' chinese problem
1.0.13

8 months ago

1.0.12

8 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago