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!
This commit is contained in:
Eric 2024-05-06 19:51:03 -07:00 committed by GitHub
parent 4f2f332622
commit 046f4ed09f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;