mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-08 21:30:50 +08:00
Made preview_format parameterizable for extensibility.
This commit is contained in:
parent
c78e6a58c0
commit
728e5de33f
@ -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;
|
||||
|
||||
@ -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) => {
|
||||
|
||||
@ -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?.();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user