Mask canvas for masked img2img
This commit is contained in:
@@ -8,12 +8,14 @@ import ComfyWidgetNode from "./ComfyWidgetNode";
|
||||
import { get, writable, type Writable } from "svelte/store";
|
||||
|
||||
export interface ComfyImageUploadNodeProperties extends ComfyWidgetProperties {
|
||||
maskCount: number
|
||||
}
|
||||
|
||||
export default class ComfyImageUploadNode extends ComfyWidgetNode<ComfyBoxImageMetadata[]> {
|
||||
properties: ComfyImageUploadNodeProperties = {
|
||||
defaultValue: [],
|
||||
tags: [],
|
||||
maskCount: 0
|
||||
}
|
||||
|
||||
static slotLayout: SlotLayout = {
|
||||
@@ -39,13 +41,21 @@ export default class ComfyImageUploadNode extends ComfyWidgetNode<ComfyBoxImageM
|
||||
super(name, [])
|
||||
}
|
||||
|
||||
override onExecute() {
|
||||
override onExecute(param: any, options: object) {
|
||||
// TODO better way of getting image size?
|
||||
const value = get(this.value)
|
||||
if (value && value.length > 0) {
|
||||
value[0].width = get(this.imgWidth)
|
||||
value[0].height = get(this.imgHeight)
|
||||
|
||||
// NOTE: assumes masks will have the same image size as the parent image!
|
||||
for (const child of value[0].children) {
|
||||
child.width = get(this.imgWidth)
|
||||
child.height = get(this.imgHeight)
|
||||
}
|
||||
}
|
||||
|
||||
super.onExecute(param, options);
|
||||
}
|
||||
|
||||
override parseValue(value: any): ComfyBoxImageMetadata[] {
|
||||
|
||||
Reference in New Issue
Block a user