From 046f4ed09f756b481a16b3e08ec3ca260a4ee745 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 6 May 2024 19:51:03 -0700 Subject: [PATCH] Update pnginfo.js why parsing in text mode a json that's already clean? also what is the purpose of `let txt_chunks = {}`? do we expect more json chunks? like multiple exif tags? one for workflow and one for prompt? no one will ever do that. we custom node dev do not have your specs to embedd the json as you want in webp/jpeg/avif. We save the whole metadata in a single exif tag called UserComment, as everyone else. Therefore, txt_chunks is unique, and contains a parsed json ready for use by app.js! --- web/scripts/pnginfo.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/web/scripts/pnginfo.js b/web/scripts/pnginfo.js index 7132fb60f..a1c7d5e90 100644 --- a/web/scripts/pnginfo.js +++ b/web/scripts/pnginfo.js @@ -128,12 +128,7 @@ export function getWebpMetadata(file) { if (String.fromCharCode(...webp.slice(offset + 8, offset + 8 + 6)) == "Exif\0\0") { offset += 6; } - let data = parseExifData(webp.slice(offset + 8, offset + 8 + chunk_length)); - for (var key in data) { - var value = data[key]; - let index = value.indexOf(':'); - txt_chunks[value.slice(0, index)] = value.slice(index + 1); - } + txt_chunks = parseExifData(webp.slice(offset + 8, offset + 8 + chunk_length)); // we get only 1 tag with the whole prompt already parsed } offset += 8 + chunk_length;