Mask Operations, Combining & Compositing
Interactive walkthrough of core image and mask nodes — create and refine masks, combine overlapping masks with different operations, and composite images…
Acerca de
Interactive walkthrough of core image and mask nodes — create and refine masks, combine overlapping masks with different operations, and composite images…
Lo que proporcionas
- Leyendo el flujo de trabajo
Se ejecuta en ComfyUI. Este flujo de trabajo no puede ejecutarse en esta página. Descárgalo y ábrelo en ComfyUI.
Descargar flujo de trabajoAún no hay resultados de muestra para este flujo de trabajo.
Dentro del flujo de trabajo
Una vista previa de solo lectura del gráfico de nodos. Ábrelo en Comfy Cloud o descárgalo para editar los nodos.
Loading the graph
Open full-size workflow preview- Comfy Cloud
- Sí
- Autor
- Autor no disponible
Requiere nodos personalizados
- Leyendo el flujo de trabajo
Usa este flujo de trabajo desde código
Se genera a partir del gráfico y las entradas del flujo de trabajo cuando es posible; de lo contrario, se muestran ejemplos almacenados. Revisa las credenciales y los endpoints antes de ejecutar el código, ya que puede generar cargos.
What you need
- Runs on
- Comfy Cloud
- Clave
- COMFY_API_KEY
Requiere un plan de pago de Cloud y créditos.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"1": {
"class_type": "EmptyImage",
"inputs": {
"batch_size": 1,
"color": 0,
"height": 1024,
"width": 1024
},
"_meta": {
"title": "Empty Image"
}
},
"2": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"1",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"3": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"5",
0
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"4": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"5",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"5": {
"class_type": "ImageToMask",
"inputs": {
"channel": "red",
"image": [
"1",
0
]
},
"_meta": {
"title": "Convert Image to Mask"
}
},
"326": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"3",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"327": {
"class_type": "InvertMask",
"inputs": {
"mask": [
"5",
0
]
},
"_meta": {
"title": "Invert Mask"
}
},
"328": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"327",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"338": {
"class_type": "ThresholdMask",
"inputs": {
"mask": [
"5",
0
],
"value": 0.4099999999999999
},
"_meta": {
"title": "Threshold Mask"
}
},
"340": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"338",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"342": {
"class_type": "FeatherMask",
"inputs": {
"bottom": 0,
"left": 200,
"mask": [
"327",
0
],
"right": 0,
"top": 0
},
"_meta": {
"title": "Feather Mask"
}
},
"343": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"342",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"359": {
"class_type": "ImageCompositeMasked",
"inputs": {
"destination": [
"1",
0
],
"mask": [
"394",
0
],
"resize_source": False,
"source": [
"360",
0
],
"x": 0,
"y": 0
},
"_meta": {
"title": "Image Composite Masked"
}
},
"360": {
"class_type": "EmptyImage",
"inputs": {
"batch_size": 1,
"color": 16711680,
"height": 1024,
"width": 1024
},
"_meta": {
"title": "Empty Image"
}
},
"367": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"360",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"368": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"359",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"369": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"377",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"374": {
"class_type": "LoadImage",
"inputs": {
"image": "example.png"
},
"_meta": {
"title": "Load Image"
}
},
"376": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"383",
0
],
"operation": "multiply",
"source": [
"398",
0
],
"x": 256,
"y": 256
},
"_meta": {
"title": "Combine Masks"
}
},
"377": {
"class_type": "SolidMask",
"inputs": {
"height": 1024,
"value": 0.5,
"width": 1024
},
"_meta": {
"title": "Create Solid Mask"
}
},
"378": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"376",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"380": {
"class_type": "SolidMask",
"inputs": {
"height": 512,
"value": 1,
"width": 512
},
"_meta": {
"title": "Create Solid Mask"
}
},
"381": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"380",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"383": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"377",
0
],
"operation": "add",
"source": [
"380",
0
],
"x": 128,
"y": 128
},
"_meta": {
"title": "Combine Masks"
}
},
"384": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"383",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"387": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"383",
0
],
"operation": "and",
"source": [
"398",
0
],
"x": 256,
"y": 256
},
"_meta": {
"title": "Combine Masks"
}
},
"388": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"387",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"389": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"383",
0
],
"operation": "or",
"source": [
"398",
0
],
"x": 256,
"y": 256
},
"_meta": {
"title": "Combine Masks"
}
},
"390": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"389",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"391": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"383",
0
],
"operation": "xor",
"source": [
"398",
0
],
"x": 256,
"y": 256
},
"_meta": {
"title": "Combine Masks"
}
},
"392": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"391",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"394": {
"class_type": "FeatherMask",
"inputs": {
"bottom": 40,
"left": 40,
"mask": [
"383",
0
],
"right": 40,
"top": 40
},
"_meta": {
"title": "Feather Mask"
}
},
"398": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"377",
0
],
"operation": "add",
"source": [
"380",
0
],
"x": 512,
"y": 512
},
"_meta": {
"title": "Combine Masks"
}
},
"399": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"398",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"400": {
"class_type": "MaskComposite",
"inputs": {
"destination": [
"383",
0
],
"operation": "add",
"source": [
"398",
0
],
"x": 256,
"y": 256
},
"_meta": {
"title": "Combine Masks"
}
},
"401": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"400",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"402": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"394",
0
]
},
"_meta": {
"title": "Preview Mask"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)