Skip to content

Commit 614faec

Browse files
committed
added the ImageAutoSelector node.
1 parent b47eb8b commit 614faec

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

py/nodes.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,37 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
13041304
return self.upscale(upscale_model, image)
13051305

13061306

1307+
class ImageAutoSelector:
1308+
@classmethod
1309+
def INPUT_TYPES(s):
1310+
return {
1311+
"required": {
1312+
},
1313+
"optional": {
1314+
"image_prior": ("IMAGE",),
1315+
"image_alternative": ("IMAGE",),
1316+
"image_third": ("IMAGE",)
1317+
}
1318+
}
1319+
1320+
RETURN_TYPES = ("IMAGE",)
1321+
RETURN_NAMES = ("image",)
1322+
FUNCTION = "select_image"
1323+
CATEGORY = "utils/image"
1324+
1325+
def select_image(self, image_prior=None, image_alternative=None, image_third=None):
1326+
if image_prior is not None:
1327+
image = image_prior
1328+
elif image_alternative is not None:
1329+
image = image_alternative
1330+
else:
1331+
image = image_third
1332+
1333+
if image is None:
1334+
raise RuntimeError("all image inputs are None")
1335+
1336+
return (image,)
1337+
13071338
NODE_CLASS_MAPPINGS = {
13081339
#image
13091340
"LoadImageWithSwitch": LoadImageWithSwitch,
@@ -1316,6 +1347,7 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
13161347
"ColorCorrectOfUtils": ColorCorrectOfUtils,
13171348
"UpscaleImageWithModelIfNeed": UpscaleImageWithModelIfNeed,
13181349
"ImageResizeTo8x": ImageResizeTo8x,
1350+
"ImageAutoSelector": ImageAutoSelector,
13191351

13201352
# text
13211353
"ConcatTextOfUtils": ConcatTextOfUtils,
@@ -1339,6 +1371,7 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
13391371

13401372
#loader
13411373
"CheckpointLoaderSimpleWithSwitch": CheckpointLoaderSimpleWithSwitch,
1374+
"ImageAutoSelector": ImageAutoSelector,
13421375
}
13431376

13441377
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -1353,6 +1386,7 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
13531386
"ColorCorrectOfUtils": "Color Correct of Utils",
13541387
"UpscaleImageWithModelIfNeed": "Upscale Image Using Model if Need",
13551388
"ImageResizeTo8x": "Image Resize to 8x",
1389+
"ImageAutoSelector": "Image Auto Selector",
13561390

13571391
# Text
13581392
"ConcatTextOfUtils": "Concat Text",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-utils-nodes"
33
description = "Nodes:LoadImageWithSwitch, ImageBatchOneOrMore, ModifyTextGender, GenderControlOutput, ImageCompositeMaskedWithSwitch, ImageCompositeMaskedOneByOne, ColorCorrectOfUtils, SplitMask, MaskFastGrow, CheckpointLoaderSimpleWithSwitch, ImageResizeTo8x, MatchImageRatioToPreset, UpscaleImageWithModelIfNeed, MaskFromFaceModel, MaskCoverFourCorners, DetectorForNSFW, DeepfaceAnalyzeFaceAttributes etc."
4-
version = "1.2.0"
4+
version = "1.2.1"
55
license = { file = "LICENSE" }
66
dependencies = []
77

0 commit comments

Comments
 (0)