Skip to main content

FilterZeroMasksAndCorrespondingImages

KJNodes/masking
FilterZeroMasksAndCorrespondingImages

Filter out all the empty (i.e. all zero) mask in masks Also filter out all the corresponding images in original_images by indexes if provide original_images (optional): If provided, need have same length as masks.

Example

JSON Example
{
  "class_type": "FilterZeroMasksAndCorrespondingImages",
  "inputs": {
    "masks": [
      "node_id",
      0
    ]
  }
}

This example shows required inputs only. Connection values like ["node_id", 0] should reference actual node IDs from your workflow.

Inputs

NameTypeStatusConstraintsDefault
masksMASKrequired--
original_imagesIMAGEoptional--

Outputs

IndexNameTypeIs ListConnection Reference
0non_zero_masks_outMASKNo["{node_id}", 0]
1non_zero_mask_images_outIMAGENo["{node_id}", 1]
2zero_mask_images_outIMAGENo["{node_id}", 2]
3zero_mask_images_out_indexesINDEXESNo["{node_id}", 3]
How to connect to these outputs

To connect another node's input to an output from this node, use the connection reference format:

["node_id", output_index]

Where node_id is the ID of this FilterZeroMasksAndCorrespondingImages node in your workflow, and output_index is the index from the table above.

Example

If this node has ID "5" in your workflow:

  • non_zero_masks_out (MASK): ["5", 0]
  • non_zero_mask_images_out (IMAGE): ["5", 1]
  • zero_mask_images_out (IMAGE): ["5", 2]
Was this page helpful?