Add SrlFilterImageList

This commit is contained in:
Sean Lynch
2023-09-28 19:07:42 -04:00
parent 5863312111
commit 3caefa641e
3 changed files with 30 additions and 0 deletions
+7
View File
@@ -42,6 +42,13 @@ ComfyUI itself isn't remotely secure, but I will probably try to
improve isolation at some point in the future to prevent unintended
problems. PRs gladly accepted if you have need for this.
## SRL Filter Image List
![Screenshot of SrlFilterImageList](screenshots/SrlFilterImageList.png)
Takes a list of images and a list of bools as input and outputs a list
of the input images where the bool is true.
# License
All code in this repository is copyright Sean Richard Lynch and any
+23
View File
@@ -132,12 +132,34 @@ class SrlEval:
return (ret,)
class SrlFilterImageList:
"""Filter an image list based on a list of bools"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"images": ("IMAGE",),
"keep": ("BOOLEAN", {"forceInput": True}),
}
}
RETURN_TYPES = ("IMAGE",)
INPUT_IS_LIST = True
OUTPUT_IS_LIST = (True,)
FUNCTION = "doit"
def doit(self, images, keep):
return ([im for im, k in zip(images, keep) if k],)
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"SRL Conditional Interrrupt": SrlConditionalInterrupt,
"SRL Format String": SrlFormatString,
"SRL Eval": SrlEval,
"SRL Filter Image List": SrlFilterImageList,
}
@@ -146,4 +168,5 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"SrlConditionalInterrupt": "SRL Conditional Interrupt",
"SrlFormatString": "SRL Format String",
"SrlEval": "SRL Eval",
"SrlFilterImageList": "SRL Filter Image List",
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB