diff --git a/.npmignore b/.npmignore index 3fb0b38..3939696 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,7 @@ .git/ .github/ test/ +deno.jsonc logo/ src/ examples/ diff --git a/README.md b/README.md index 9b126df..e837838 100644 --- a/README.md +++ b/README.md @@ -7,36 +7,44 @@ This library provides functionality to extract information stored within PNG images generated by Stable Diffusion Web UI. -## Usage +It also provides functions to mutually convert between infotext and JSON formats. + +## Usage(extract infotext in PNG images) + +You can use `getInfotext` or `getInfotextJson` to extract infotext embedded in PNG images. Support `CJS/ESM/UMD` ### CommonJS ```javascript -const { getPngInfo } = require('chilled-lemon'); +const { getInfotext, getInfotextJson } = require('chilled-lemon'); const { readFile } = require('node:fs/promises'); (async () => { const buf = await readFile('./test.png'); - const jsonOutput = await getPngInfo(buf); - console.log(jsonOutput); - const textOutput = await getPngInfo(buf, { format: 'text' }); - console.log(textOutput); + + const infotext = await getInfotext(buf); + console.log(infotext); + + const json = await getInfotextJson(buf); + console.log(json); })(); ``` ### ES Modules ```javascript -import { getPngInfo } from 'chilled-lemon'; +import { getInfotext, getInfotextJson } from 'chilled-lemon'; import { readFile } from 'node:fs/promises'; const buf = await readFile('./test.png'); -const jsonOutput = await getPngInfo(buf); -console.log(jsonOutput); -const textOutput = await getPngInfo(buf, { format: 'text' }); -console.log(textOutput); + +const infotext = await getInfotext(buf); +console.log(infotext); + +const json = await getInfotextJson(buf); +console.log(json); ``` @@ -56,7 +64,7 @@ console.log(textOutput);