rename node category
This commit is contained in:
@@ -27,7 +27,7 @@ class PrepareImageAndMaskForInpaint:
|
||||
},
|
||||
"optional": {
|
||||
"controlnet_image": ("IMAGE",),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("IMAGE", "MASK", "IMAGE", "CROP_REGION", "IMAGE")
|
||||
@@ -89,7 +89,9 @@ class PrepareImageAndMaskForInpaint:
|
||||
cropped_mask = pil_mask.crop(crop_region)
|
||||
|
||||
final_pil_img = resize_image(cropped_img, out_width, out_height, ResizeMode.RESIZE_TO_FIT)
|
||||
final_pil_mask = resize_image(cropped_mask, out_width, out_height, ResizeMode.RESIZE_TO_FIT).convert("L")
|
||||
final_pil_mask = resize_image(cropped_mask, out_width, out_height, ResizeMode.RESIZE_TO_FIT).convert(
|
||||
"L"
|
||||
)
|
||||
|
||||
if controlnet_image is not None:
|
||||
pil_cimg = tensor2pil(controlnet_image[idx])
|
||||
@@ -103,7 +105,9 @@ class PrepareImageAndMaskForInpaint:
|
||||
x1, y1, x2, y2 = crop_region
|
||||
cn_crop_region = (int(x1 * scale_x), int(y1 * scale_y), int(x2 * scale_x), int(y2 * scale_y))
|
||||
cropped_cn_img = pil_cimg.crop(cn_crop_region)
|
||||
final_cn_img = resize_image(cropped_cn_img, cn_target_width, cn_target_height, ResizeMode.RESIZE_TO_FIT)
|
||||
final_cn_img = resize_image(
|
||||
cropped_cn_img, cn_target_width, cn_target_height, ResizeMode.RESIZE_TO_FIT
|
||||
)
|
||||
processed_controlnet_images.append(pil2tensor(final_cn_img))
|
||||
|
||||
else:
|
||||
@@ -129,7 +133,6 @@ class PrepareImageAndMaskForInpaint:
|
||||
masks.append(pil2tensor(final_pil_mask))
|
||||
crop_regions.append(torch.tensor(crop_region, dtype=torch.int64))
|
||||
|
||||
|
||||
if processed_controlnet_images:
|
||||
final_controlnet_tensor = torch.cat(processed_controlnet_images, dim=0)
|
||||
else:
|
||||
|
||||
@@ -41,13 +41,9 @@ class ColorBlend:
|
||||
|
||||
def color_blending_mode(self, bw_layer, color_layer):
|
||||
if bw_layer.shape[0] < color_layer.shape[0]:
|
||||
bw_layer = bw_layer.repeat(color_layer.shape[0], 1, 1, 1)[
|
||||
: color_layer.shape[0]
|
||||
]
|
||||
bw_layer = bw_layer.repeat(color_layer.shape[0], 1, 1, 1)[: color_layer.shape[0]]
|
||||
if bw_layer.shape[0] > color_layer.shape[0]:
|
||||
color_layer = color_layer.repeat(bw_layer.shape[0], 1, 1, 1)[
|
||||
: bw_layer.shape[0]
|
||||
]
|
||||
color_layer = color_layer.repeat(bw_layer.shape[0], 1, 1, 1)[: bw_layer.shape[0]]
|
||||
|
||||
batch_size, *_ = bw_layer.shape
|
||||
tensor_output = torch.empty_like(bw_layer)
|
||||
@@ -70,8 +66,6 @@ class ColorBlend:
|
||||
for i in range(batch_size):
|
||||
blend = color_blend(image1[i], image2[i])
|
||||
blend = np.stack([blend])
|
||||
tensor_output[i : i + 1] = (
|
||||
torch.from_numpy(blend.transpose(0, 3, 1, 2)) / 255.0
|
||||
).permute(0, 2, 3, 1)
|
||||
tensor_output[i : i + 1] = (torch.from_numpy(blend.transpose(0, 3, 1, 2)) / 255.0).permute(0, 2, 3, 1)
|
||||
|
||||
return (tensor_output,)
|
||||
|
||||
@@ -161,12 +161,15 @@ class UtilLoadImageFromUrl:
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"image": ("STRING", {
|
||||
"image": (
|
||||
"STRING",
|
||||
{
|
||||
"default": "",
|
||||
"placeholder": "Input image paths or URLS one per line. Eg:\nhttps://example.com/image.png\nfile:///path/to/local/image.jpg\ndata:image/png;base64,...",
|
||||
"multiline": True,
|
||||
"dynamicPrompts": False,
|
||||
}),
|
||||
},
|
||||
),
|
||||
},
|
||||
"optional": {
|
||||
"keep_alpha_channel": (
|
||||
@@ -243,12 +246,15 @@ class UtilLoadImageAsMaskFromUrl(UtilLoadImageFromUrl):
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"image": ("STRING", {
|
||||
"image": (
|
||||
"STRING",
|
||||
{
|
||||
"default": "",
|
||||
"placeholder": "Input image paths or URLS one per line. Eg:\nhttps://example.com/image.png\nfile:///path/to/local/image.jpg\ndata:image/png;base64,...",
|
||||
"multiline": True,
|
||||
"dynamicPrompts": False,
|
||||
}),
|
||||
},
|
||||
),
|
||||
"channel": (["alpha", "red", "green", "blue"],),
|
||||
},
|
||||
"optional": {
|
||||
|
||||
Reference in New Issue
Block a user