mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 14:50:49 +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']] = 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)
|
if(ComfyApp.clipspace.images)
|
||||||
ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath;
|
ComfyApp.clipspace.images[ComfyApp.clipspace['selectedIndex']] = filepath;
|
||||||
|
|||||||
@ -49,6 +49,12 @@ export class ComfyApp {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.shiftDown = false;
|
this.shiftDown = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* file format for preview
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
this.preview_format = "jpeg";
|
||||||
}
|
}
|
||||||
|
|
||||||
static isImageNode(node) {
|
static isImageNode(node) {
|
||||||
@ -371,7 +377,7 @@ export class ComfyApp {
|
|||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.onload = () => r(img);
|
img.onload = () => r(img);
|
||||||
img.onerror = () => r(null);
|
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) => {
|
).then((imgs) => {
|
||||||
|
|||||||
@ -303,7 +303,7 @@ export const ComfyWidgets = {
|
|||||||
subfolder = name.substring(0, folder_separator);
|
subfolder = name.substring(0, folder_separator);
|
||||||
name = name.substring(folder_separator + 1);
|
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?.();
|
node.setSizeForImage?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user