mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-08 00:50:05 +00:00
Show dropped image in output node
- blobUrl is an optional paramtere in loadGraphData - sets the preview image on SaveImage and PreviewImage nodes - works for any dropped png or webp, also from the queue
This commit is contained in:
@@ -2277,7 +2277,8 @@ export class ComfyApp {
|
||||
clean: boolean = true,
|
||||
restore_view: boolean = true,
|
||||
workflow: string | null | ComfyWorkflow = null,
|
||||
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {}
|
||||
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {},
|
||||
droppedImageBlobUrl: string | undefined = undefined
|
||||
) {
|
||||
if (clean !== false) {
|
||||
this.clean()
|
||||
@@ -2468,6 +2469,15 @@ export class ComfyApp {
|
||||
}
|
||||
}
|
||||
|
||||
// Show dropped image on output nodes
|
||||
if (
|
||||
droppedImageBlobUrl &&
|
||||
(node.type === 'SaveImage' || node.type === 'PreviewImage')
|
||||
) {
|
||||
// @ts-expect-error
|
||||
this.nodePreviewImages[String(node.id)] = [droppedImageBlobUrl]
|
||||
}
|
||||
|
||||
this.#invokeExtensions('loadedGraphNode', node)
|
||||
}
|
||||
|
||||
@@ -2759,7 +2769,9 @@ export class ComfyApp {
|
||||
JSON.parse(pngInfo.workflow),
|
||||
true,
|
||||
true,
|
||||
fileName
|
||||
fileName,
|
||||
undefined,
|
||||
URL.createObjectURL(file)
|
||||
)
|
||||
} else if (pngInfo?.prompt) {
|
||||
this.loadApiJson(JSON.parse(pngInfo.prompt), fileName)
|
||||
@@ -2777,7 +2789,14 @@ export class ComfyApp {
|
||||
const prompt = pngInfo?.prompt || pngInfo?.Prompt
|
||||
|
||||
if (workflow) {
|
||||
this.loadGraphData(JSON.parse(workflow), true, true, fileName)
|
||||
this.loadGraphData(
|
||||
JSON.parse(workflow),
|
||||
true,
|
||||
true,
|
||||
fileName,
|
||||
undefined,
|
||||
URL.createObjectURL(file)
|
||||
)
|
||||
} else if (prompt) {
|
||||
this.loadApiJson(JSON.parse(prompt), fileName)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user