MCPcopy Create free account
hub / github.com/BadCafeCode/masquerade-nodes-comfyui / ImageToMask

Class ImageToMask

MaskNodes.py:433–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431 return (result,)
432
433class ImageToMask:
434 def __init__(self):
435 pass
436
437 @classmethod
438 def INPUT_TYPES(cls):
439 return {
440 "required": {
441 "image": ("IMAGE",),
442 "method": (["intensity", "alpha"],),
443 },
444 }
445
446 RETURN_TYPES = ("MASK",)
447 FUNCTION = "convert"
448
449 CATEGORY = "Masquerade Nodes"
450
451 def convert(self, image, method):
452 if method == "intensity":
453 if len(image.shape) > 3 and image.shape[3] == 4:
454 image = tensor2rgb(image)
455 return (tensor2mask(image),)
456 else:
457 return (tensor2rgba(image)[:,:,:,0],)
458
459class MixByMask:
460 def __init__(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected