diff --git a/web/extensions/core/maskeditor.js b/web/extensions/core/maskeditor.js index 0d3faee58..4b0266f77 100644 --- a/web/extensions/core/maskeditor.js +++ b/web/extensions/core/maskeditor.js @@ -41,7 +41,7 @@ async function uploadMask(filepath, formData) { }); ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']] = new Image(); - ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src = "/view?" + new URLSearchParams(filepath).toString() + "&preview=jpeg"; + ComfyApp.clipspace.imgs[ComfyApp.clipspace['selectedIndex']].src = "/view?" + new URLSearchParams(filepath).toString() + "&preview="+app.preview_format; if(ComfyApp.clipspace.images) ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath; diff --git a/web/scripts/app.js b/web/scripts/app.js index d466675f4..8d25a9085 100644 --- a/web/scripts/app.js +++ b/web/scripts/app.js @@ -49,6 +49,12 @@ export class ComfyApp { * @type {boolean} */ this.shiftDown = false; + + /** + * file format for preview + * @type {string} + */ + this.preview_format = "jpeg"; } static isImageNode(node) { @@ -371,7 +377,7 @@ export class ComfyApp { const img = new Image(); img.onload = () => r(img); img.onerror = () => r(null); - img.src = "/view?" + new URLSearchParams(src).toString() + "&preview=jpeg"; + img.src = "/view?" + new URLSearchParams(src).toString() + "&preview="+app.preview_format; }); }) ).then((imgs) => { diff --git a/web/scripts/widgets.js b/web/scripts/widgets.js index cc493057e..fd50ce36f 100644 --- a/web/scripts/widgets.js +++ b/web/scripts/widgets.js @@ -303,7 +303,7 @@ export const ComfyWidgets = { subfolder = name.substring(0, folder_separator); name = name.substring(folder_separator + 1); } - img.src = `/view?filename=${name}&type=input&subfolder=${subfolder}&preview=jpeg`; + img.src = `/view?filename=${name}&type=input&subfolder=${subfolder}&preview=${app.preview_format}`; node.setSizeForImage?.(); }