The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Cleanup webp import code a bit.
comfyanonymousaac8fc99d6a0
diff --git a/web/scripts/pnginfo.js b/web/scripts/pnginfo.jsindex 4dc3a032c..491caed79 100644--- a/web/scripts/pnginfo.js+++ b/web/scripts/pnginfo.js@@ -108,29 +108,25 @@ export function getWebpMetadata(file) {return new Promise((r) => {const reader = new FileReader();reader.onload = (event) => {- // Get the PNG data as a Uint8Array- const pngData = new Uint8Array(event.target.result);- const dataView = new DataView(pngData.buffer);+ const webp = new Uint8Array(event.target.result);+ const dataView = new DataView(webp.buffer);- // Check that the PNG signature is present+ // Check that the WEBP signature is presentif (dataView.getUint32(0) !== 0x52494646 || dataView.getUint32(8) !== 0x57454250) {console.error("Not a valid WEBP file");r();return;}- // Start searching for chunks after the PNG signature+ // Start searching for chunks after the WEBP signaturelet offset = 12;let txt_chunks = {};- // Loop through the chunks in the PNG file- while (offset < pngData.length) {- // Get the length of the chunk- const length = dataView.getUint32(offset + 4, true);- // Get the chunk type- const type = String.fromCharCode(...pngData.slice(offset, offset + 4));- if (type === "EXIF") {- // Get the keyword- let data = parseExifData(pngData.slice(offset + 8, offset + 8 + length));+ // Loop through the chunks in the WEBP file+ while (offset < webp.length) {+ const chunk_length = dataView.getUint32(offset + 4, true);+ const chunk_type = String.fromCharCode(...webp.slice(offset, offset + 4));+ if (chunk_type === "EXIF") {+ let data = parseExifData(webp.slice(offset + 8, offset + 8 + chunk_length));for (var key in data) {var value = data[key];let index = value.indexOf(':');@@ -138,7 +134,7 @@ export function getWebpMetadata(file) {}}- offset += 8 + length;+ offset += 8 + chunk_length;}r(txt_chunks);