@@ -1304,6 +1304,37 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
1304
1304
return self .upscale (upscale_model , image )
1305
1305
1306
1306
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
+
1307
1338
NODE_CLASS_MAPPINGS = {
1308
1339
#image
1309
1340
"LoadImageWithSwitch" : LoadImageWithSwitch ,
@@ -1316,6 +1347,7 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
1316
1347
"ColorCorrectOfUtils" : ColorCorrectOfUtils ,
1317
1348
"UpscaleImageWithModelIfNeed" : UpscaleImageWithModelIfNeed ,
1318
1349
"ImageResizeTo8x" : ImageResizeTo8x ,
1350
+ "ImageAutoSelector" : ImageAutoSelector ,
1319
1351
1320
1352
# text
1321
1353
"ConcatTextOfUtils" : ConcatTextOfUtils ,
@@ -1339,6 +1371,7 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
1339
1371
1340
1372
#loader
1341
1373
"CheckpointLoaderSimpleWithSwitch" : CheckpointLoaderSimpleWithSwitch ,
1374
+ "ImageAutoSelector" : ImageAutoSelector ,
1342
1375
}
1343
1376
1344
1377
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -1353,6 +1386,7 @@ def forward(self, image, upscale_model, threshold_of_xl_area=0.9):
1353
1386
"ColorCorrectOfUtils" : "Color Correct of Utils" ,
1354
1387
"UpscaleImageWithModelIfNeed" : "Upscale Image Using Model if Need" ,
1355
1388
"ImageResizeTo8x" : "Image Resize to 8x" ,
1389
+ "ImageAutoSelector" : "Image Auto Selector" ,
1356
1390
1357
1391
# Text
1358
1392
"ConcatTextOfUtils" : "Concat Text" ,
0 commit comments