diff --git a/package.json b/package.json index 593721f..6920fe2 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,12 @@ "stable", "diffusion", "webui", + "sdwebui", + "sd", + "prompt", + "prompts", + "Stable Diffusion web UI", + "Stable Diffusion", "create-by-yarn-tool", "create-by-tsdx" ], @@ -93,10 +99,13 @@ "ncu": "yarn-tool ncu -u", "tsc:showConfig": "ynpx get-current-tsconfig -p" }, + "dependencies": { + "split-smartly2": "^2.0.1" + }, "devDependencies": { "@bluelovers/tsconfig": "^1.0.35", "@types/jest": "^29.5.12", - "@types/node": "^20.12.7" + "@types/node": "^20.12.11" }, "packageManager": "yarn@1.22.19" } diff --git a/src/handler.ts b/src/handler.ts new file mode 100644 index 0000000..e131791 --- /dev/null +++ b/src/handler.ts @@ -0,0 +1,23 @@ +import { IOptionsInfoparser } from './index'; + +export function keyToSnakeStyle1(key: string) +{ + return key.toLowerCase().replace(/ /g, '_') +} + +export function handleInfoEntries(entries: readonly (readonly [string, string])[], opts?: IOptionsInfoparser) +{ + const cast_to_snake = opts?.cast_to_snake; + const re = /^0\d/; + + return entries.map(([key, value]) => + { + const asNum = parseFloat(value); + const isNotNum = (re.test(value)) || isNaN(asNum) || ((value as any as number) - asNum) !== 0; + + if (cast_to_snake) key = keyToSnakeStyle1(key) + + const out = [key, isNotNum ? value : asNum] as const; + return out + }) +} diff --git a/src/index.ts b/src/index.ts index 98f258b..5716641 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,117 +1,83 @@ -/** - * get int32 from png compensating for endianness - */ -export function i32(a: Uint8Array, - i: number, -) +import { inputToBytes } from './utils'; +import { _parseInfoLine, extractPromptAndInfoFromRaw } from './parser'; +import { extractRawFromBytes } from './png'; +import { handleInfoEntries } from './handler'; + +export interface IOptionsInfoparser { - return new Uint32Array(new Uint8Array([...a.slice(i, i + 4)].reverse()).buffer)[0]; + cast_to_snake?: boolean; + isIncludePrompts?: boolean; } -export function infoparser(line: string) +export function infoparser(line: string, opts?: IOptionsInfoparser) { - let output: Record = {} - let buffer = '' - let key: string - let quotes = false - //actually no idea why there are trailing : sometimes? - if (line.at(-1) === ':') line = line.slice(0, -1) + let base = [] as ReturnType + if (opts?.isIncludePrompts) + { + const { + prompt, + negative_prompt, + infoline, + } = extractPromptAndInfoFromRaw(line); - let c_pre: string; + base.push(['prompt', prompt]); + base.push(['negative_prompt', negative_prompt]); + line = infoline; + } - for (let i = 0; i < line.length; i++) - { - let c = line[i]; - let sp = true; + return Object.fromEntries(base.concat(handleInfoEntries(_parseInfoLine(line), opts))) +} - if (c === '"') - { - quotes = !quotes - } +/** + * @example + * import fs from 'fs/promises' + * import PNGINFO from 'auto1111-pnginfo' + * + * const file = await fs.readFile('generate_waifu.png') + * const info = PNGINFO(file) + * + * console.log(info) + */ +export function PNGINFO(png: Uint8Array | string, cast_to_snake = false) +{ + let bytes = inputToBytes(png) as Uint8Array; - if (!quotes) - { - if (c === ':') - { - key = buffer.trim(); - buffer = '' - sp = false; - } - else if (c === ',') - { - if (key === 'Cutoff targets' && c_pre !== ']') - { + const raw = extractRawFromBytes(bytes); + if (!raw) return; - } - else - { - output[key] = buffer.slice(1); - buffer = ''; - sp = false; - } - } - } + const { + raw_info, + width, + height + } = raw; - if (sp) - { - buffer += c; - } + const { + prompt, + negative_prompt, + infoline, + infoline_extra, + //lines_raw, + } = extractPromptAndInfoFromRaw(raw_info as any) - c_pre = c; - } - if (key) output[key] = buffer.slice(1) - return output -} + let data = infoparser(infoline, { + cast_to_snake + }); -export function PNGINFO(png: Uint8Array | string, cast_to_snake = false) -{ - let bin_str: string, bytes: Uint8Array - if (typeof Buffer !== 'undefined' && Buffer.isBuffer(png)) - { - bytes = Uint8Array.from(png) - bin_str = png.toString() + let output = { + metadata: { + width, + height, + extra: infoline_extra, + raw_info + }, + pnginfo: { + prompt, + negative_prompt, + ...data, + }, } - else if (png instanceof Uint8Array) - { - bytes = png - bin_str = png.toString() - } - else - { - bin_str = atob(png.slice(0, 8192)) - bytes = Uint8Array.from(bin_str, c => c.charCodeAt(0)) - } - // @ts-ignore - const pngmagic = bytes.slice(0, 8) == '137,80,78,71,13,10,26,10' - if (!pngmagic) return - let [ihdrSize, width, height] = [i32(bytes, 8), i32(bytes, 16), i32(bytes, 20)] - let txtOffset = 8 + ihdrSize + 12 - if (bin_str.slice(txtOffset + 4, txtOffset + 8) != 'tEXt') return - let txtSize = i32(bytes, txtOffset) - let raw_info = bin_str.slice(txtOffset + 8 + "parameters\u0000".length, txtOffset + 8 + txtSize) - let infolines = raw_info.split('\n') - let negative_prompt_index = infolines.findIndex(a => a.match(/^Negative prompt:/)) - let prompt = infolines.splice(0, negative_prompt_index).join('\n').trim() - let steps_index = infolines.findIndex(a => a.match(/^Steps:/)) - let negative_prompt = infolines.splice(0, steps_index).join('\n').slice('Negative prompt:'.length).trim() - let infoline = infolines.splice(0, 1)[0] - let data = infoparser(infoline) - data = Object.fromEntries( - Object.entries(data).map(([key, value]) => - { - let asNum = parseFloat(value) - // @ts-ignore - let isNotNum = value - asNum - // @ts-ignore - if (cast_to_snake) key = key.toLowerCase().replaceAll(' ', '_') - let out = [key, isNotNum || isNaN(isNotNum) ? value : asNum] - return out - }), - ) - - let output = { width, height, prompt, negative_prompt, extra: infolines, raw_info } - return Object.assign(output, data) + return output } // @ts-ignore @@ -123,7 +89,6 @@ if (process.env.TSDX_FORMAT !== 'esm') Object.defineProperty(PNGINFO, 'default', { value: PNGINFO }); Object.defineProperty(PNGINFO, 'infoparser', { value: infoparser }); - Object.defineProperty(PNGINFO, 'i32', { value: i32 }); } export default PNGINFO diff --git a/src/parser.ts b/src/parser.ts new file mode 100644 index 0000000..24ee229 --- /dev/null +++ b/src/parser.ts @@ -0,0 +1,137 @@ +import { splitSmartly } from 'split-smartly2'; +import { _isRawVersionPlus, _splitRawToLines } from './split'; + +/** + * `${key}: ${value}` + */ +export function _parseLine(line: string) +{ + const [, key, value] = line.match(/^([^:]+)\s*:\s*(.*)$/); + return [key, value] as const +} + +/** + * Parses an info line into key-value pairs. + * + * @param infoline - The info line to parse. + * @returns An array of tuples, where each tuple contains a key-value pair. + * + * @remarks + * This function uses the `splitSmartly` function from the 'split-smartly2' package to split the info line into key-value pairs. + * The info line is expected to be in the format `${key}: ${value}`, separated by commas. + * The `splitSmartly` function is configured to handle nested brackets and trim separators. + * + * @example + * ```typescript + * const infoLine = 'key1: value1, key2: value2, key3: value3'; + * const result = _parseInfoLine(infoLine); + * // result: [['key1', 'value1'], ['key2', 'value2'], ['key3', 'value3']] + * ``` + */ +export function _parseInfoLine(infoline: string) +{ + const entries = splitSmartly(infoline, [','], { + brackets: true, + trimSeparators: true, + }) as string[]; + + return entries.map(_parseLine) +} + +/** + * Extracts prompt, negative prompt, info line, and extra info from a raw info string. + * + * @param raw_info - The raw info string to extract data from. + * @returns An object containing the extracted prompt, negative prompt, info line, extra info, and the original lines. + * + * @throws Will throw a TypeError if the raw info string is in Plus version and contains more than 3 lines. + * + * @remarks + * This function first checks if the raw info string is in Plus version using the `_isRawVersionPlus` function. + * It then splits the raw info string into lines using the `_splitRawToLines` function. + * Depending on the version, it extracts the prompt, negative prompt, info line, and extra info. + * If the raw info string is in Plus version, it follows a specific order to extract the data. + * If the raw info string is not in Plus version, it uses the `findIndex` method to find the indices of the negative prompt and steps, + * and then extracts the data accordingly. + * Finally, it returns an object containing the extracted data and the original lines. + * + * @example + * ```typescript + * const rawInfo = 'Prompt:...\nNegative prompt:...\nSteps:...'; + * const result = extractPromptAndInfoFromRaw(rawInfo); + * // result: { + * // prompt: '...', + * // negative_prompt: '...', + * // infoline: 'Steps:...', + * // infoline_extra: [], + * // lines_raw: ['Prompt:...', 'Negative prompt:...', 'Steps:...'], + * // } + * ``` + */ +export function extractPromptAndInfoFromRaw(raw_info: string) +{ + const isPlus = _isRawVersionPlus(raw_info); + let lines = _splitRawToLines(raw_info); + + let prompt: string = ''; + let negative_prompt: string = ''; + let infoline: string = ''; + let infoline_extra: string[] = []; + + const lines_raw = lines.slice(); + + if (isPlus) + { + if (lines.length > 3) + { + throw new TypeError() + } + + let line = lines.pop(); + + if (line.startsWith('Steps: ')) + { + infoline = line; + line = void 0 + } + + line ??= lines.pop(); + + if (line.startsWith('Negative prompt: ')) + { + negative_prompt = line.slice('Negative prompt: '.length); + line = void 0 + } + + line ??= lines.pop(); + + prompt = line; + + if (lines.length) + { + throw new TypeError() + } + } + else + { + let negative_prompt_index = lines.findIndex(a => a.match(/^Negative prompt:/)) + prompt = lines.splice(0, negative_prompt_index).join('\n').trim() + let steps_index = lines.findIndex(a => a.match(/^Steps:/)) + negative_prompt = lines.splice(0, steps_index).join('\n').slice('Negative prompt:'.length).trim() + + infoline = lines.splice(0, 1)[0]; + + infoline_extra = lines; + } + + prompt = prompt.replace(/\x00\x00\x00/g, ''); + negative_prompt = negative_prompt.replace(/\x00\x00\x00/g, ''); + + return { + prompt, + negative_prompt, + infoline, + infoline_extra, + lines_raw, + } +} diff --git a/src/png.ts b/src/png.ts new file mode 100644 index 0000000..8dc6f81 --- /dev/null +++ b/src/png.ts @@ -0,0 +1,61 @@ +import { i32 } from './utils'; + +const BYTES_pngmagic = '137,80,78,71,13,10,26,10'; +const BYTES_tEXt = Uint8Array.from('tEXt', c => c.charCodeAt(0)).join(','); + +const OFFSET_parameters = "parameters\u0000".length + +export function uint8arrayToString(uint8array: Uint8Array) +{ + return new TextDecoder().decode(uint8array) +} + +/** + * ``` + * new TextEncoder().encode(inputString) + * String.fromCharCode(...raw_info) + * ``` + */ +export function stringToUint8Array(inputString: string) +{ + return new TextEncoder().encode(inputString); +} + +/** + * Extracts raw data from a PNG byte array. + * + * @param bytes - The Uint8Array containing the PNG data. + * @returns An object containing the width, height, and raw_info extracted from the PNG data, + * or `undefined` if the PNG data does not contain a valid tEXt chunk. + */ +export function extractRawFromBytes(bytes: Uint8Array) +{ + // Check if the bytes represent a valid PNG file by comparing the magic number + const pngmagic = bytes.slice(0, 8).join(',') === BYTES_pngmagic + if (!pngmagic) return undefined + + // Extract the width, height, and IHDR size from the PNG data + const [ihdrSize, width, height] = [i32(bytes, 8), i32(bytes, 16), i32(bytes, 20)]; + + // Calculate the offset of the tEXt chunk in the PNG data + const txtOffset = 8 + ihdrSize + 12; + + // Check if the tEXt chunk is present by comparing the chunk type + if (bytes.slice(txtOffset + 4, txtOffset + 8).join(',') !== BYTES_tEXt) return undefined + + // Extract the size of the tEXt chunk data + const txtSize = i32(bytes, txtOffset); + + // Extract the raw_info data from the tEXt chunk + const raw_info = bytes.slice(txtOffset + 8 + OFFSET_parameters, txtOffset + 8 + txtSize); + + // Convert the raw_info data to a string + const raw_info_str = uint8arrayToString(raw_info); + + // Return the extracted data + return { + width, + height, + raw_info: raw_info_str, + } +} diff --git a/src/split.ts b/src/split.ts new file mode 100644 index 0000000..0521ed0 --- /dev/null +++ b/src/split.ts @@ -0,0 +1,46 @@ +/** + * \n + */ +export const RE_LINE_SPLIT_BASE = /\r?\n/; +/** + * \x00\x00\x00\n + */ +export const RE_LINE_SPLIT_PLUS = /\x00\x00\x00\r?\n/; + +/** + * Splits a raw string into an array of lines. + * + * @param raw_info - The raw string to split into lines. + * @returns An array of lines extracted from the raw string. + * + * @example + * ```typescript + * const rawInfo = "line1\nline2\r\nline3"; + * const lines = _splitRawToLines(rawInfo); + * console.log(lines); // Output: ["line1", "line2", "line3"] + * ``` + */ +export function _splitRawToLines(raw_info: string) +{ + return raw_info.split(_isRawVersionPlus(raw_info) ? RE_LINE_SPLIT_PLUS : RE_LINE_SPLIT_BASE) +} + +/** + * Checks if the given raw string is in "\x00\x00\x00\n" format. + * + * @see https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15713 + * + * @param raw_info - The raw string to check. + * @returns A boolean indicating whether the raw string is in "\x00\x00\x00\n" format. + * + * @example + * ```typescript + * const rawInfo = "line1\nline2\x00\x00\x00\r\nline3"; + * const isPlusFormat = _isRawVersionPlus(rawInfo); + * console.log(isPlusFormat); // Output: true + * ``` + */ +export function _isRawVersionPlus(raw_info: string) +{ + return RE_LINE_SPLIT_PLUS.test(raw_info) +} diff --git a/src/utils.ts b/src/utils.ts new file mode 100644 index 0000000..2617a30 --- /dev/null +++ b/src/utils.ts @@ -0,0 +1,34 @@ + +export function inputToBytes(png: Uint8Array | string) +{ + /** + * if (typeof Buffer !== 'undefined' && Buffer.isBuffer(png)) + * { + * bytes = Uint8Array.from(png) + * bin_str = png.toString() + * } + * else if (png instanceof Uint8Array) + * { + * bytes = png + * bin_str = png.toString() + * } + */ + if (typeof Buffer !== 'undefined' && Buffer.isBuffer(png) || png instanceof Uint8Array) + { + return png + } + + /** + * bin_str = atob(png.slice(0, 8192)) + * bytes = Uint8Array.from(bin_str, c => c.charCodeAt(0)) + */ + return Uint8Array.from(atob(png.slice(0, 8192)), c => c.charCodeAt(0)) +} + +/** + * get int32 from png compensating for endianness + */ +export function i32(a: Uint8Array, i: number) +{ + return new Uint32Array(new Uint8Array([...a.slice(i, i + 4)].reverse()).buffer)[0]; +} diff --git a/test/__root.ts b/test/__root.ts new file mode 100644 index 0000000..37a171f --- /dev/null +++ b/test/__root.ts @@ -0,0 +1,7 @@ +import { join } from "path"; + +export const __ROOT = join(__dirname, '..'); + +export const isWin = process.platform === "win32"; + +export const __FIXTURES = join(__dirname, 'fixtures'); diff --git a/test/__snapshots__/fixtures.spec.ts.snap b/test/__snapshots__/fixtures.spec.ts.snap new file mode 100644 index 0000000..6693fe5 --- /dev/null +++ b/test/__snapshots__/fixtures.spec.ts.snap @@ -0,0 +1,235 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`fixtures.spec isIncludePrompts/20240510_143418-geminixMixRealistic_bV10-20-557152044.txt 1`] = ` +{ + "ADetailer ControlNet model": "Passthrough", + "ADetailer confidence": 0.3, + "ADetailer confidence 2nd": 0.3, + "ADetailer denoising strength": 0.4, + "ADetailer denoising strength 2nd": 0.4, + "ADetailer dilate erode": 4, + "ADetailer dilate erode 2nd": 4, + "ADetailer inpaint only masked": "True", + "ADetailer inpaint only masked 2nd": "True", + "ADetailer inpaint padding": 32, + "ADetailer inpaint padding 2nd": 32, + "ADetailer mask blur": 4, + "ADetailer mask blur 2nd": 4, + "ADetailer model": "face_yolov8n_v2.pt", + "ADetailer model 2nd": "PitHandDetailer-v1-seg.pt", + "ADetailer prompt": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, (otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world), (fantasy world)"", + "ADetailer prompt 2nd": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, (otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world), (fantasy world)"", + "ADetailer version": "24.4.2", + "CFG scale": 7, + "Cutoff disable_for_neg": "True", + "Cutoff enabled": "True", + "Cutoff interpolation": "lerp", + "Cutoff padding": "_", + "Cutoff strong": "False", + "Cutoff targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", + "Cutoff weight": 0.5, + "Model": "geminixMixRealistic_bV10", + "Model hash": "5307b134ff", + "Negative Template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "Sampler": "DPM++ 2M Karras", + "Seed": 557152044, + "Size": "512x768", + "Steps": 20, + "TI hashes": ""EasyNegative: c74b4e810b03"", + "Template": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world)"", + "VAE": "kl-f8-anime2.ckpt", + "VAE hash": "df3c506e51", + "Version": "f0.0.17v1.8.0rc-1.7.0", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "prompt": "(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, +Linens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world)", + "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "sv_prompt": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, __cf-*/prompt-costume__, \\n__cf-*/location/*__, (fantasy world)"", +} +`; + +exports[`fixtures.spec isIncludePrompts/20240510_143423-geminixMixRealistic_bV10-20-557152045.txt 1`] = ` +{ + "ADetailer ControlNet model": "Passthrough", + "ADetailer confidence": 0.3, + "ADetailer confidence 2nd": 0.3, + "ADetailer denoising strength": 0.4, + "ADetailer denoising strength 2nd": 0.4, + "ADetailer dilate erode": 4, + "ADetailer dilate erode 2nd": 4, + "ADetailer inpaint only masked": "True", + "ADetailer inpaint only masked 2nd": "True", + "ADetailer inpaint padding": 32, + "ADetailer inpaint padding 2nd": 32, + "ADetailer mask blur": 4, + "ADetailer mask blur 2nd": 4, + "ADetailer model": "face_yolov8n_v2.pt", + "ADetailer model 2nd": "PitHandDetailer-v1-seg.pt", + "ADetailer prompt": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, (otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world), (fantasy world)"", + "ADetailer prompt 2nd": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, (otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world), (fantasy world)"", + "ADetailer version": "24.4.2", + "CFG scale": 7, + "Cutoff disable_for_neg": "True", + "Cutoff enabled": "True", + "Cutoff interpolation": "lerp", + "Cutoff padding": "_", + "Cutoff strong": "False", + "Cutoff targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", + "Cutoff weight": 0.5, + "Model": "geminixMixRealistic_bV10", + "Model hash": "5307b134ff", + "Negative Template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "Sampler": "DPM++ 2M Karras", + "Seed": 557152045, + "Size": "512x768", + "Steps": 20, + "TI hashes": ""EasyNegative: c74b4e810b03"", + "Template": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world)"", + "VAE": "kl-f8-anime2.ckpt", + "VAE hash": "df3c506e51", + "Version": "f0.0.17v1.8.0rc-1.7.0", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "prompt": "(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, wearing Red and green striped sweater dress, green stockings, red knee-high boots, gingerbread headband, clutching a mug of hot cocoa, +Haunted Cemetery Entrance, Overgrown path leading through rusted iron gates, crumbling tombstones covered in moss, eerie mist drifting among gnarled trees, and the sound of distant whispers in the air, (fantasy world)", + "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "sv_prompt": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, __cf-*/prompt-costume__, \\n__cf-*/location/*__, (fantasy world)"", +} +`; + +exports[`fixtures.spec isIncludePrompts/20240510_143439-geminixMixRealistic_bV10-20-557152046.txt 1`] = ` +{ + "ADetailer ControlNet model": "Passthrough", + "ADetailer confidence": 0.3, + "ADetailer confidence 2nd": 0.3, + "ADetailer denoising strength": 0.4, + "ADetailer denoising strength 2nd": 0.4, + "ADetailer dilate erode": 4, + "ADetailer dilate erode 2nd": 4, + "ADetailer inpaint only masked": "True", + "ADetailer inpaint only masked 2nd": "True", + "ADetailer inpaint padding": 32, + "ADetailer inpaint padding 2nd": 32, + "ADetailer mask blur": 4, + "ADetailer mask blur 2nd": 4, + "ADetailer model": "face_yolov8n_v2.pt", + "ADetailer model 2nd": "PitHandDetailer-v1-seg.pt", + "ADetailer prompt": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, (otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, samurai wearing a samurai armor, Armor chest piece with peony engraving, plated arm guards, plated leg guards, leather boots, helmet with crest, \\npolice car Trunk, Spacious compartment containing emergency equipment such as cones, flares, fire extinguisher, portable toolbox, rifle rack with a shotgun secured in place, spare tire tucked away in the corner, (fantasy world), (fantasy world)"", + "ADetailer prompt 2nd": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, (otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, samurai wearing a samurai armor, Armor chest piece with peony engraving, plated arm guards, plated leg guards, leather boots, helmet with crest, \\npolice car Trunk, Spacious compartment containing emergency equipment such as cones, flares, fire extinguisher, portable toolbox, rifle rack with a shotgun secured in place, spare tire tucked away in the corner, (fantasy world), (fantasy world)"", + "ADetailer version": "24.4.2", + "CFG scale": 7, + "Cutoff disable_for_neg": "True", + "Cutoff enabled": "True", + "Cutoff interpolation": "lerp", + "Cutoff padding": "_", + "Cutoff strong": "False", + "Cutoff targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", + "Cutoff weight": 0.5, + "Model": "geminixMixRealistic_bV10", + "Model hash": "5307b134ff", + "Negative Template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "Sampler": "DPM++ 2M Karras", + "Seed": 557152046, + "Size": "512x768", + "Steps": 20, + "TI hashes": ""EasyNegative: c74b4e810b03"", + "Template": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, female prehistoric cavewoman wearing Animal fur bandeau top with bone accents, fur loincloth, bone hair ornament, hide sandals, teeth necklace,hide belt,shell bracelet, \\nLinens Closet, Deep in the heart of the hospital, this closet houses stacks of crisp white sheets and fluffy towels, detergent, industrial washing machine, (fantasy world)"", + "VAE": "kl-f8-anime2.ckpt", + "VAE hash": "df3c506e51", + "Version": "f0.0.17v1.8.0rc-1.7.0", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "prompt": "(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, samurai wearing a samurai armor, Armor chest piece with peony engraving, plated arm guards, plated leg guards, leather boots, helmet with crest, +police car Trunk, Spacious compartment containing emergency equipment such as cones, flares, fire extinguisher, portable toolbox, rifle rack with a shotgun secured in place, spare tire tucked away in the corner, (fantasy world)", + "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, artist signature, artist logo, twitter username, patreon username, copyright name, copyright notice, copyright abbreviation, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "sv_prompt": ""(otherworldly), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, __cf-*/prompt-costume__, \\n__cf-*/location/*__, (fantasy world)"", +} +`; + +exports[`fixtures.spec isIncludePromptsBase/20231224_200247-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt 1`] = ` +{ + "ADetailer confidence": 0.3, + "ADetailer confidence 2nd": 0.3, + "ADetailer denoising strength": 0.4, + "ADetailer denoising strength 2nd": 0.4, + "ADetailer dilate erode": 32, + "ADetailer dilate erode 2nd": 32, + "ADetailer inpaint only masked": "True", + "ADetailer inpaint only masked 2nd": "True", + "ADetailer inpaint padding": 32, + "ADetailer inpaint padding 2nd": 32, + "ADetailer mask blur": 4, + "ADetailer mask blur 2nd": 4, + "ADetailer model": "face_yolov8n.pt", + "ADetailer model 2nd": "hand_yolov8n.pt", + "ADetailer prompt": ""(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]"", + "ADetailer prompt 2nd": ""(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]"", + "ADetailer version": "23.11.1", + "CFG scale": 7, + "Lora hashes": ""tutuMCV5: d9ff24d0c793"", + "Model": "0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7 + meinacetusorionmix_v10 x 0.15 + darkSushiMixMix_225D x 0.15", + "Model hash": "37c999fae4", + "Sampler": "DPM++ 2M Karras", + "Seed": 3633774045, + "Size": "512x768", + "Steps": 20, + "TI hashes": ""EasyNegative: c74b4e810b03"", + "VAE": "kl-f8-anime2.ckpt", + "VAE hash": "df3c506e51", + "Version": "v1.7.0-133-gde03882d", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username,watermark,signature,time signature, timestamp, artist name, copyright name, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra hands, extra legs, extra digits, extra_fingers, wrong finger, inaccurate limb), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "prompt": "(otherworldly, otherworldly atmosphere, otherworldly appearance), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (long_hair, long hair), collar, earrings, jewelry, +(random colors cloth, random colors hair, random long hair, dynamic hair, glowing hair), +long hair, eyelashes, eyeliner, makeup, hair over one eye, +(dynamic pose), (dynamic weather), (dynamic background), nsfw, +lamp, +tutututu, christmas, breasts, santa costume, bare shoulders, bow, bowtie, underwear, thong, swimsuit, +black pantyhose, +(1girl:1.3), extreme detailed, colorful, highest detailed, ((an extremely delicate and beautiful)), cinematic light, petite, anubis attire, solo, (abstract art:1), full body, moon, night, ((ancient egyptian theme)), (anubis ears), pyramids, staff, (gold), golden ornaments, ((expressionless)), pharao, hierography, portrait, body tattoo, face tattoo, active pose, over head lighting, fangs, glowing eyes, sitting, relics, +, +(smiling at viewer), (fantasy world)", +} +`; + +exports[`fixtures.spec isIncludePromptsBase/20231224_200248-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt 1`] = ` +{ + "ADetailer confidence": 0.3, + "ADetailer confidence 2nd": 0.3, + "ADetailer denoising strength": 0.4, + "ADetailer denoising strength 2nd": 0.4, + "ADetailer dilate erode": 32, + "ADetailer dilate erode 2nd": 32, + "ADetailer inpaint only masked": "True", + "ADetailer inpaint only masked 2nd": "True", + "ADetailer inpaint padding": 32, + "ADetailer inpaint padding 2nd": 32, + "ADetailer mask blur": 4, + "ADetailer mask blur 2nd": 4, + "ADetailer model": "face_yolov8n.pt", + "ADetailer model 2nd": "hand_yolov8n.pt", + "ADetailer prompt": ""(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]"", + "ADetailer prompt 2nd": ""(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]"", + "ADetailer version": "23.11.1", + "CFG scale": 7, + "Lora hashes": ""tutuMCV5: d9ff24d0c793"", + "Model": "0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7 + meinacetusorionmix_v10 x 0.15 + darkSushiMixMix_225D x 0.15", + "Model hash": "37c999fae4", + "Sampler": "DPM++ 2M Karras", + "Seed": 3633774045, + "Size": "512x768", + "Steps": 20, + "TI hashes": ""EasyNegative: c74b4e810b03"", + "VAE": "kl-f8-anime2.ckpt", + "VAE hash": "df3c506e51", + "Version": "v1.7.0-133-gde03882d", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username,watermark,signature,time signature, timestamp, artist name, copyright name, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra hands, extra legs, extra digits, extra_fingers, wrong finger, inaccurate limb), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "prompt": "(otherworldly, otherworldly atmosphere, otherworldly appearance), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (long_hair, long hair), collar, earrings, jewelry, +(random colors cloth, random colors hair, random long hair, dynamic hair, glowing hair), +long hair, eyelashes, eyeliner, makeup, hair over one eye, +(dynamic pose), (dynamic weather), (dynamic background), nsfw, +lamp, +tutututu, christmas, breasts, santa costume, bare shoulders, bow, bowtie, underwear, thong, swimsuit, +black pantyhose, +(1girl:1.3), extreme detailed, colorful, highest detailed, ((an extremely delicate and beautiful)), cinematic light, petite, anubis attire, solo, (abstract art:1), full body, moon, night, ((ancient egyptian theme)), (anubis ears), pyramids, staff, (gold), golden ornaments, ((expressionless)), pharao, hierography, portrait, body tattoo, face tattoo, active pose, over head lighting, fangs, glowing eyes, sitting, relics, +, +(smiling at viewer), (fantasy world)", +} +`; diff --git a/test/__snapshots__/info.spec.ts.snap b/test/__snapshots__/info.spec.ts.snap index 17aff33..bed8c60 100644 --- a/test/__snapshots__/info.spec.ts.snap +++ b/test/__snapshots__/info.spec.ts.snap @@ -2,106 +2,114 @@ exports[`info.spec PNGINFO 1`] = ` { - "ADetailer ControlNet model": "Passthrough", - "ADetailer confidence": 0.3, - "ADetailer confidence 2nd": 0.3, - "ADetailer denoising strength": 0.4, - "ADetailer denoising strength 2nd": 0.4, - "ADetailer dilate erode": 4, - "ADetailer dilate erode 2nd": 4, - "ADetailer inpaint only masked": "True", - "ADetailer inpaint only masked 2nd": "True", - "ADetailer inpaint padding": 32, - "ADetailer inpaint padding 2nd": 32, - "ADetailer mask blur": 4, - "ADetailer mask blur 2nd": 4, - "ADetailer model": "lips_v1.pt", - "ADetailer model 2nd": "hand_yolov8n.pt", - "ADetailer prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (Vietnamese lips:1.2)"", - "ADetailer prompt 2nd": ""(perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, [PROMPT]"", - "ADetailer version": "24.4.2", - "CFG scale": 7, - "Cutoff disable_for_neg": "True", - "Cutoff enabled": "True", - "Cutoff interpolation": "lerp", - "Cutoff padding": "_", - "Cutoff strong": "False", - "Cutoff targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", - "Cutoff weight": 0.5, - "Model": "geminixMixRealistic_bV10", - "Model hash": "5307b134ff", - "Negative Template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", - "Sampler": "DPM++ 2M Karras", - "Seed": 557152045, - "Size": "512x512", - "Steps": 20, - "TI hashes": ""EasyNegative: c74b4e810b03"", - "Template": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", - "VAE": "kl-f8-anime2.ckpt", - "VAE hash": "df3c506e51", - "Version": "f0.0.17v1.8.0rc-1.7.0", - "extra": [], - "height": 512, - "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", - "prompt": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", - "raw_info": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo + "metadata": { + "extra": [], + "height": 512, + "raw_info": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo Negative prompt: EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6) Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 557152045, Size: 512x512, Model hash: 5307b134ff, Model: geminixMixRealistic_bV10, VAE hash: df3c506e51, VAE: kl-f8-anime2.ckpt, ADetailer model: lips_v1.pt, ADetailer prompt: "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (Vietnamese lips:1.2)", ADetailer confidence: 0.3, ADetailer dilate erode: 4, ADetailer mask blur: 4, ADetailer denoising strength: 0.4, ADetailer inpaint only masked: True, ADetailer inpaint padding: 32, ADetailer ControlNet model: Passthrough, ADetailer model 2nd: hand_yolov8n.pt, ADetailer prompt 2nd: "(perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, [PROMPT]", ADetailer confidence 2nd: 0.3, ADetailer dilate erode 2nd: 4, ADetailer mask blur 2nd: 4, ADetailer denoising strength 2nd: 0.4, ADetailer inpaint only masked 2nd: True, ADetailer inpaint padding 2nd: 32, ADetailer version: 24.4.2, sv_prompt: "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", sv_negative: "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", Template: "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", Negative Template: "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", Cutoff enabled: True, Cutoff targets: ["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"], Cutoff padding: _, Cutoff weight: 0.5, Cutoff disable_for_neg: True, Cutoff strong: False, Cutoff interpolation: lerp, TI hashes: "EasyNegative: c74b4e810b03", Version: f0.0.17v1.8.0rc-1.7.0", - "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", - "sv_prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", - "width": 512, + "width": 512, + }, + "pnginfo": { + "ADetailer ControlNet model": "Passthrough", + "ADetailer confidence": 0.3, + "ADetailer confidence 2nd": 0.3, + "ADetailer denoising strength": 0.4, + "ADetailer denoising strength 2nd": 0.4, + "ADetailer dilate erode": 4, + "ADetailer dilate erode 2nd": 4, + "ADetailer inpaint only masked": "True", + "ADetailer inpaint only masked 2nd": "True", + "ADetailer inpaint padding": 32, + "ADetailer inpaint padding 2nd": 32, + "ADetailer mask blur": 4, + "ADetailer mask blur 2nd": 4, + "ADetailer model": "lips_v1.pt", + "ADetailer model 2nd": "hand_yolov8n.pt", + "ADetailer prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (Vietnamese lips:1.2)"", + "ADetailer prompt 2nd": ""(perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, [PROMPT]"", + "ADetailer version": "24.4.2", + "CFG scale": 7, + "Cutoff disable_for_neg": "True", + "Cutoff enabled": "True", + "Cutoff interpolation": "lerp", + "Cutoff padding": "_", + "Cutoff strong": "False", + "Cutoff targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", + "Cutoff weight": 0.5, + "Model": "geminixMixRealistic_bV10", + "Model hash": "5307b134ff", + "Negative Template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "Sampler": "DPM++ 2M Karras", + "Seed": 557152045, + "Size": "512x512", + "Steps": 20, + "TI hashes": ""EasyNegative: c74b4e810b03"", + "Template": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", + "VAE": "kl-f8-anime2.ckpt", + "VAE hash": "df3c506e51", + "Version": "f0.0.17v1.8.0rc-1.7.0", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "prompt": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", + "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "sv_prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", + }, } `; exports[`info.spec PNGINFO:cast_to_snake 1`] = ` { - "adetailer_confidence": 0.3, - "adetailer_confidence_2nd": 0.3, - "adetailer_controlnet_model": "Passthrough", - "adetailer_denoising_strength": 0.4, - "adetailer_denoising_strength_2nd": 0.4, - "adetailer_dilate_erode": 4, - "adetailer_dilate_erode_2nd": 4, - "adetailer_inpaint_only_masked": "True", - "adetailer_inpaint_only_masked_2nd": "True", - "adetailer_inpaint_padding": 32, - "adetailer_inpaint_padding_2nd": 32, - "adetailer_mask_blur": 4, - "adetailer_mask_blur_2nd": 4, - "adetailer_model": "lips_v1.pt", - "adetailer_model_2nd": "hand_yolov8n.pt", - "adetailer_prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (Vietnamese lips:1.2)"", - "adetailer_prompt_2nd": ""(perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, [PROMPT]"", - "adetailer_version": "24.4.2", - "cfg_scale": 7, - "cutoff_disable_for_neg": "True", - "cutoff_enabled": "True", - "cutoff_interpolation": "lerp", - "cutoff_padding": "_", - "cutoff_strong": "False", - "cutoff_targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", - "cutoff_weight": 0.5, - "extra": [], - "height": 512, - "model": "geminixMixRealistic_bV10", - "model_hash": "5307b134ff", - "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", - "negative_template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", - "prompt": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", - "raw_info": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo + "metadata": { + "extra": [], + "height": 512, + "raw_info": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo Negative prompt: EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6) Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 557152045, Size: 512x512, Model hash: 5307b134ff, Model: geminixMixRealistic_bV10, VAE hash: df3c506e51, VAE: kl-f8-anime2.ckpt, ADetailer model: lips_v1.pt, ADetailer prompt: "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (Vietnamese lips:1.2)", ADetailer confidence: 0.3, ADetailer dilate erode: 4, ADetailer mask blur: 4, ADetailer denoising strength: 0.4, ADetailer inpaint only masked: True, ADetailer inpaint padding: 32, ADetailer ControlNet model: Passthrough, ADetailer model 2nd: hand_yolov8n.pt, ADetailer prompt 2nd: "(perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, [PROMPT]", ADetailer confidence 2nd: 0.3, ADetailer dilate erode 2nd: 4, ADetailer mask blur 2nd: 4, ADetailer denoising strength 2nd: 0.4, ADetailer inpaint only masked 2nd: True, ADetailer inpaint padding 2nd: 32, ADetailer version: 24.4.2, sv_prompt: "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", sv_negative: "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", Template: "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", Negative Template: "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", Cutoff enabled: True, Cutoff targets: ["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"], Cutoff padding: _, Cutoff weight: 0.5, Cutoff disable_for_neg: True, Cutoff strong: False, Cutoff interpolation: lerp, TI hashes: "EasyNegative: c74b4e810b03", Version: f0.0.17v1.8.0rc-1.7.0", - "sampler": "DPM++ 2M Karras", - "seed": 557152045, - "size": "512x512", - "steps": 20, - "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", - "sv_prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", - "template": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", - "ti_hashes": ""EasyNegative: c74b4e810b03"", - "vae": "kl-f8-anime2.ckpt", - "vae_hash": "df3c506e51", - "version": "f0.0.17v1.8.0rc-1.7.0", - "width": 512, + "width": 512, + }, + "pnginfo": { + "adetailer_confidence": 0.3, + "adetailer_confidence_2nd": 0.3, + "adetailer_controlnet_model": "Passthrough", + "adetailer_denoising_strength": 0.4, + "adetailer_denoising_strength_2nd": 0.4, + "adetailer_dilate_erode": 4, + "adetailer_dilate_erode_2nd": 4, + "adetailer_inpaint_only_masked": "True", + "adetailer_inpaint_only_masked_2nd": "True", + "adetailer_inpaint_padding": 32, + "adetailer_inpaint_padding_2nd": 32, + "adetailer_mask_blur": 4, + "adetailer_mask_blur_2nd": 4, + "adetailer_model": "lips_v1.pt", + "adetailer_model_2nd": "hand_yolov8n.pt", + "adetailer_prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), (Vietnamese lips:1.2)"", + "adetailer_prompt_2nd": ""(perfect face, beautiful face, perfect lips, perfect mouth, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts, perfect body, perfect anatomy), (perfect hands, perfect hand anatomy, perfect finger, beautiful finger, perfect hands, good hands:1.2), beautiful and aesthetic, [PROMPT]"", + "adetailer_version": "24.4.2", + "cfg_scale": 7, + "cutoff_disable_for_neg": "True", + "cutoff_enabled": "True", + "cutoff_interpolation": "lerp", + "cutoff_padding": "_", + "cutoff_strong": "False", + "cutoff_targets": "["white", "black", "green", "red", "blue", "yellow", "pink", "purple", "bronze", "blonde", "silver", "magenta"]", + "cutoff_weight": 0.5, + "model": "geminixMixRealistic_bV10", + "model_hash": "5307b134ff", + "negative_prompt": "EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)", + "negative_template": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "prompt": "highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo", + "sampler": "DPM++ 2M Karras", + "seed": 557152045, + "size": "512x512", + "steps": 20, + "sv_negative": ""EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username, watermark, signature, time signature, timestamp, artist name, copyright name, copyright signature, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra digits, extra_fingers, wrong finger, inaccurate limb, bad hand, bad fingers), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6)"", + "sv_prompt": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", + "template": ""highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (very aesthetic, beautiful and aesthetic), 1girl, solo"", + "ti_hashes": ""EasyNegative: c74b4e810b03"", + "vae": "kl-f8-anime2.ckpt", + "vae_hash": "df3c506e51", + "version": "f0.0.17v1.8.0rc-1.7.0", + }, } `; diff --git a/test/fixtures.spec.ts b/test/fixtures.spec.ts new file mode 100644 index 0000000..a1b8ab5 --- /dev/null +++ b/test/fixtures.spec.ts @@ -0,0 +1,39 @@ +//@noUnusedParameters:false +//@noImplicitAny:false +/// +/// +/// + +import { basename, extname, join } from 'path'; +// @ts-ignore +import { globSync, readFileSync } from 'fs'; +import { __FIXTURES } from './__root'; +import { infoparser } from '../src/index'; +import { validPngInfo } from './lib/valid'; + +beforeAll(async () => +{ + +}); + +describe(basename(__filename, extname(__filename)), () => +{ + test.each(globSync([ + 'isIncludePrompts/*.txt', + 'isIncludePromptsBase/*.txt', + ], { + cwd: __FIXTURES + // @ts-ignore + }).map(v => v.replace(/\\/g, '/')))('%s', (file) => { + const buf = readFileSync(join(__FIXTURES, file)) + + let actual = infoparser(buf.toString(), { + isIncludePrompts: true, + }); + + expect(actual).toMatchSnapshot(); + validPngInfo(actual); + }) + +}) + diff --git a/test/fixtures/isIncludePrompts/20240510_143418-geminixMixRealistic_bV10-20-557152044.txt b/test/fixtures/isIncludePrompts/20240510_143418-geminixMixRealistic_bV10-20-557152044.txt new file mode 100644 index 0000000..95b74ee Binary files /dev/null and b/test/fixtures/isIncludePrompts/20240510_143418-geminixMixRealistic_bV10-20-557152044.txt differ diff --git a/test/fixtures/isIncludePrompts/20240510_143423-geminixMixRealistic_bV10-20-557152045.txt b/test/fixtures/isIncludePrompts/20240510_143423-geminixMixRealistic_bV10-20-557152045.txt new file mode 100644 index 0000000..9cfb739 Binary files /dev/null and b/test/fixtures/isIncludePrompts/20240510_143423-geminixMixRealistic_bV10-20-557152045.txt differ diff --git a/test/fixtures/isIncludePrompts/20240510_143439-geminixMixRealistic_bV10-20-557152046.txt b/test/fixtures/isIncludePrompts/20240510_143439-geminixMixRealistic_bV10-20-557152046.txt new file mode 100644 index 0000000..989d195 Binary files /dev/null and b/test/fixtures/isIncludePrompts/20240510_143439-geminixMixRealistic_bV10-20-557152046.txt differ diff --git a/test/fixtures/isIncludePromptsBase/20231224_200247-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt b/test/fixtures/isIncludePromptsBase/20231224_200247-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt new file mode 100644 index 0000000..d45247f --- /dev/null +++ b/test/fixtures/isIncludePromptsBase/20231224_200247-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt @@ -0,0 +1,12 @@ +(otherworldly, otherworldly atmosphere, otherworldly appearance), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (long_hair, long hair), collar, earrings, jewelry, +(random colors cloth, random colors hair, random long hair, dynamic hair, glowing hair), +long hair, eyelashes, eyeliner, makeup, hair over one eye, +(dynamic pose), (dynamic weather), (dynamic background), nsfw, +lamp, +tutututu, christmas, breasts, santa costume, bare shoulders, bow, bowtie, underwear, thong, swimsuit, +black pantyhose, +(1girl:1.3), extreme detailed, colorful, highest detailed, ((an extremely delicate and beautiful)), cinematic light, petite, anubis attire, solo, (abstract art:1), full body, moon, night, ((ancient egyptian theme)), (anubis ears), pyramids, staff, (gold), golden ornaments, ((expressionless)), pharao, hierography, portrait, body tattoo, face tattoo, active pose, over head lighting, fangs, glowing eyes, sitting, relics, +, +(smiling at viewer), (fantasy world) +Negative prompt: EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username,watermark,signature,time signature, timestamp, artist name, copyright name, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra hands, extra legs, extra digits, extra_fingers, wrong finger, inaccurate limb), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6) +Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 3633774045, Size: 512x768, Model hash: 37c999fae4, Model: 0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7 + meinacetusorionmix_v10 x 0.15 + darkSushiMixMix_225D x 0.15, VAE hash: df3c506e51, VAE: kl-f8-anime2.ckpt, ADetailer model: face_yolov8n.pt, ADetailer prompt: "(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]", ADetailer confidence: 0.3, ADetailer dilate erode: 32, ADetailer mask blur: 4, ADetailer denoising strength: 0.4, ADetailer inpaint only masked: True, ADetailer inpaint padding: 32, ADetailer model 2nd: hand_yolov8n.pt, ADetailer prompt 2nd: "(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]", ADetailer confidence 2nd: 0.3, ADetailer dilate erode 2nd: 32, ADetailer mask blur 2nd: 4, ADetailer denoising strength 2nd: 0.4, ADetailer inpaint only masked 2nd: True, ADetailer inpaint padding 2nd: 32, ADetailer version: 23.11.1, Lora hashes: "tutuMCV5: d9ff24d0c793", TI hashes: "EasyNegative: c74b4e810b03", Version: v1.7.0-133-gde03882d diff --git a/test/fixtures/isIncludePromptsBase/20231224_200248-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt b/test/fixtures/isIncludePromptsBase/20231224_200248-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt new file mode 100644 index 0000000..d45247f --- /dev/null +++ b/test/fixtures/isIncludePromptsBase/20231224_200248-0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7-20-3633774045.txt @@ -0,0 +1,12 @@ +(otherworldly, otherworldly atmosphere, otherworldly appearance), highly insanely detailed, masterpiece, top quality, best quality, highres, 4k, 8k, RAW photo, (long_hair, long hair), collar, earrings, jewelry, +(random colors cloth, random colors hair, random long hair, dynamic hair, glowing hair), +long hair, eyelashes, eyeliner, makeup, hair over one eye, +(dynamic pose), (dynamic weather), (dynamic background), nsfw, +lamp, +tutututu, christmas, breasts, santa costume, bare shoulders, bow, bowtie, underwear, thong, swimsuit, +black pantyhose, +(1girl:1.3), extreme detailed, colorful, highest detailed, ((an extremely delicate and beautiful)), cinematic light, petite, anubis attire, solo, (abstract art:1), full body, moon, night, ((ancient egyptian theme)), (anubis ears), pyramids, staff, (gold), golden ornaments, ((expressionless)), pharao, hierography, portrait, body tattoo, face tattoo, active pose, over head lighting, fangs, glowing eyes, sitting, relics, +, +(smiling at viewer), (fantasy world) +Negative prompt: EasyNegative, (normal quality, low quality, worst quality:1.4), jpeg artifacts, (username,watermark,signature,time signature, timestamp, artist name, copyright name, copyright), (loli, child, infant, baby:1.3), (bad anatomy, extra hands, extra legs, extra digits, extra_fingers, wrong finger, inaccurate limb), (African American, African:1.6), (tits, nipple:1.6), (pubic hair:1.6) +Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 3633774045, Size: 512x768, Model hash: 37c999fae4, Model: 0.7(15.Realistic_geminixMix_v20x0.4+asianrealisticSdlife_v90x0.3+magmix_v80x0.3.fp16) + 0.3(15.Realistic_mengxMixReal_v2) x 0.7 + meinacetusorionmix_v10 x 0.15 + darkSushiMixMix_225D x 0.15, VAE hash: df3c506e51, VAE: kl-f8-anime2.ckpt, ADetailer model: face_yolov8n.pt, ADetailer prompt: "(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]", ADetailer confidence: 0.3, ADetailer dilate erode: 32, ADetailer mask blur: 4, ADetailer denoising strength: 0.4, ADetailer inpaint only masked: True, ADetailer inpaint padding: 32, ADetailer model 2nd: hand_yolov8n.pt, ADetailer prompt 2nd: "(perfect detailed face, perfect detailed eyes, beautiful detailed eyes, beautiful detailed face, highly detailed face and eyeperfect lips, perfect mouth, perfect detailed finger, beautiful detailed finger, perfect detailed leg, beautiful detailed leg, perfect accurate limb, perfect beautiful breasts), [PROMPT]", ADetailer confidence 2nd: 0.3, ADetailer dilate erode 2nd: 32, ADetailer mask blur 2nd: 4, ADetailer denoising strength 2nd: 0.4, ADetailer inpaint only masked 2nd: True, ADetailer inpaint padding 2nd: 32, ADetailer version: 23.11.1, Lora hashes: "tutuMCV5: d9ff24d0c793", TI hashes: "EasyNegative: c74b4e810b03", Version: v1.7.0-133-gde03882d diff --git a/test/lib/valid.ts b/test/lib/valid.ts new file mode 100644 index 0000000..13c8442 --- /dev/null +++ b/test/lib/valid.ts @@ -0,0 +1,21 @@ +/** + * Created by user on 2024/5/10. + */ + +export function validPngInfo(pnginfo: Record) +{ + if ('prompt' in pnginfo) + { + expect(pnginfo['prompt']).not.toMatch(/\x00\x00\x00/) + } + + if ('negative_prompt' in pnginfo) + { + expect(pnginfo['negative_prompt']).not.toMatch(/\x00\x00\x00/) + } + + if ('Cutoff targets' in pnginfo) + { + expect(pnginfo['Cutoff targets']).toMatch(/^\[.*\]$/) + } +}