| 431 | return (result,) |
| 432 | |
| 433 | class 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 | |
| 459 | class MixByMask: |
| 460 | def __init__(self): |
nothing calls this directly
no outgoing calls
no test coverage detected