@@ -12226,6 +12226,10 @@ def INPUT_TYPES(self):
1222612226 "padding_right": ("INT", {"default": 64, "min": 0, "max": 0xffffffffffffffff}),
1222712227 "padding_top": ("INT", {"default": 64, "min": 0, "max": 0xffffffffffffffff}),
1222812228 "padding_bottom": ("INT", {"default": 64, "min": 0, "max": 0xffffffffffffffff}),
12229+
12230+ },
12231+ "optional":{
12232+ "return_list": ("BOOLEAN", {"default": False}),
1222912233 }
1223012234 }
1223112235
@@ -12234,7 +12238,7 @@ def INPUT_TYPES(self):
1223412238
1223512239 CATEGORY = "WAS Suite/Image/Bound"
1223612240
12237- def bounded_image_crop_with_mask(self, image, mask, padding_left, padding_right, padding_top, padding_bottom):
12241+ def bounded_image_crop_with_mask(self, image, mask, padding_left, padding_right, padding_top, padding_bottom,return_list=False ):
1223812242 # Ensure we are working with batches
1223912243 image = image.unsqueeze(0) if image.dim() == 3 else image
1224012244 mask = mask.unsqueeze(0) if mask.dim() == 2 else mask
@@ -12261,8 +12265,9 @@ def bounded_image_crop_with_mask(self, image, mask, padding_left, padding_right,
1226112265 # Even if only a single mask, create a bounds for each cropped image
1226212266 all_bounds.append([rmin, rmax, cmin, cmax])
1226312267 cropped_images.append(image[i][rmin:rmax+1, cmin:cmax+1, :])
12264-
12265- return torch.stack(cropped_images), all_bounds
12268+ if return_list:
12269+ return cropped_images, all_bounds
12270+ return torch.stack(cropped_images), all_bounds
1226612271
1226712272# DEBUG IMAGE BOUNDS TO CONSOLE
1226812273
0 commit comments