puts nodes in sub menus

unfortunately breaks previous, but I should have done this from start
This commit is contained in:
EllangoK
2023-05-06 16:25:35 -04:00
parent 33a525b059
commit 34dfeb316c
21 changed files with 40 additions and 40 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ class ArithmeticBlend:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "arithmetic_blend_images" FUNCTION = "arithmetic_blend_images"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def arithmetic_blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_mode: str): def arithmetic_blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_mode: str):
if blend_mode == "add": if blend_mode == "add":
+1 -1
View File
@@ -24,7 +24,7 @@ class Blend:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "blend_images" FUNCTION = "blend_images"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_factor: float, blend_mode: str): def blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_factor: float, blend_mode: str):
if image1.shape != image2.shape: if image1.shape != image2.shape:
+1 -1
View File
@@ -28,7 +28,7 @@ class Blur:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "blur" FUNCTION = "blur"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Filters"
def blur(self, image: torch.Tensor, blur_radius: int, sigma: float): def blur(self, image: torch.Tensor, blur_radius: int, sigma: float):
if blur_radius == 0: if blur_radius == 0:
+1 -1
View File
@@ -30,7 +30,7 @@ class CannyEdgeDetection:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "canny" FUNCTION = "canny"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Masks"
def canny(self, image: torch.Tensor, lower_threshold: int, upper_threshold: int): def canny(self, image: torch.Tensor, lower_threshold: int, upper_threshold: int):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
+1 -1
View File
@@ -36,7 +36,7 @@ class ChromaticAberration:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "chromatic_aberration" FUNCTION = "chromatic_aberration"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def chromatic_aberration(self, image: torch.Tensor, red_shift: int, green_shift: int, blue_shift: int, red_direction: str, green_direction: str, blue_direction: str): def chromatic_aberration(self, image: torch.Tensor, red_shift: int, green_shift: int, blue_shift: int, red_direction: str, green_direction: str, blue_direction: str):
def get_shift(direction, shift): def get_shift(direction, shift):
+1 -1
View File
@@ -55,7 +55,7 @@ class ColorCorrect:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "color_correct" FUNCTION = "color_correct"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def color_correct(self, image: torch.Tensor, temperature: float, hue: float, brightness: float, contrast: float, saturation: float, gamma: float): def color_correct(self, image: torch.Tensor, temperature: float, hue: float, brightness: float, contrast: float, saturation: float, gamma: float):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
+1 -1
View File
@@ -22,7 +22,7 @@ class Dissolve:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "dissolve_images" FUNCTION = "dissolve_images"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def dissolve_images(self, image1: torch.Tensor, image2: torch.Tensor, dissolve_factor: float): def dissolve_images(self, image1: torch.Tensor, image2: torch.Tensor, dissolve_factor: float):
dither_pattern = torch.rand_like(image1) dither_pattern = torch.rand_like(image1)
+1 -1
View File
@@ -23,7 +23,7 @@ class DodgeAndBurn:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "dodge_and_burn" FUNCTION = "dodge_and_burn"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def dodge_and_burn(self, image: torch.Tensor, mask: torch.Tensor, intensity: float, mode: str): def dodge_and_burn(self, image: torch.Tensor, mask: torch.Tensor, intensity: float, mode: str):
if mode in ["dodge", "color_dodge", "linear_dodge"]: if mode in ["dodge", "color_dodge", "linear_dodge"]:
+1 -1
View File
@@ -40,7 +40,7 @@ class FilmGrain:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "film_grain" FUNCTION = "film_grain"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def film_grain(self, image: torch.Tensor, intensity: float, scale: float, temperature: float, vignette: float): def film_grain(self, image: torch.Tensor, intensity: float, scale: float, temperature: float, vignette: float):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
+1 -1
View File
@@ -28,7 +28,7 @@ class Glow:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_glow" FUNCTION = "apply_glow"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_glow(self, image: torch.Tensor, intensity: float, blur_radius: int): def apply_glow(self, image: torch.Tensor, intensity: float, blur_radius: int):
blurred_image = self.gaussian_blur(image, 2 * blur_radius + 1) blurred_image = self.gaussian_blur(image, 2 * blur_radius + 1)
+1 -1
View File
@@ -25,7 +25,7 @@ class KuwaharaBlur:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_kuwahara_filter" FUNCTION = "apply_kuwahara_filter"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Filters"
def apply_kuwahara_filter(self, image: np.ndarray, blur_radius: int, method: str): def apply_kuwahara_filter(self, image: np.ndarray, blur_radius: int, method: str):
if blur_radius == 0: if blur_radius == 0:
+1 -1
View File
@@ -33,7 +33,7 @@ class Parabolize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "parabolize_image" FUNCTION = "parabolize_image"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def parabolize_image(self, image: torch.Tensor, coeff: float, vertex_x: float, vertex_y: float): def parabolize_image(self, image: torch.Tensor, coeff: float, vertex_x: float, vertex_y: float):
parabolized_image = coeff * torch.pow(image - vertex_x, 2) + vertex_y parabolized_image = coeff * torch.pow(image - vertex_x, 2) + vertex_y
+1 -1
View File
@@ -28,7 +28,7 @@ class PencilSketch:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_sketch" FUNCTION = "apply_sketch"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_sketch(self, image: torch.Tensor, blur_radius: int = 5, sharpen_alpha: float = 1): def apply_sketch(self, image: torch.Tensor, blur_radius: int = 5, sharpen_alpha: float = 1):
image = image.permute(0, 3, 1, 2) # Torch wants (B, C, H, W) we use (B, H, W, C) image = image.permute(0, 3, 1, 2) # Torch wants (B, C, H, W) we use (B, H, W, C)
+1 -1
View File
@@ -27,7 +27,7 @@ class PixelSort:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "sort_pixels" FUNCTION = "sort_pixels"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def sort_pixels(self, image: torch.Tensor, mask: torch.Tensor, direction: str, span_limit: int, sort_by: str, order: str): def sort_pixels(self, image: torch.Tensor, mask: torch.Tensor, direction: str, span_limit: int, sort_by: str, order: str):
horizontal_sort = direction == "horizontal" horizontal_sort = direction == "horizontal"
+1 -1
View File
@@ -22,7 +22,7 @@ class Pixelize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_pixelize" FUNCTION = "apply_pixelize"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_pixelize(self, image: torch.Tensor, pixel_size: int): def apply_pixelize(self, image: torch.Tensor, pixel_size: int):
pixelized_image = self.pixelize_image(image, pixel_size) pixelized_image = self.pixelize_image(image, pixel_size)
+1 -1
View File
@@ -24,7 +24,7 @@ class Quantize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "quantize" FUNCTION = "quantize"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def quantize(self, image: torch.Tensor, colors: int = 256, dither: str = "FLOYDSTEINBERG"): def quantize(self, image: torch.Tensor, colors: int = 256, dither: str = "FLOYDSTEINBERG"):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
+1 -1
View File
@@ -21,7 +21,7 @@ class Sepia:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "sepia" FUNCTION = "sepia"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def sepia(self, image: torch.Tensor, strength: float): def sepia(self, image: torch.Tensor, strength: float):
if strength == 0: if strength == 0:
+1 -1
View File
@@ -29,7 +29,7 @@ class Sharpen:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "sharpen" FUNCTION = "sharpen"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Filters"
def sharpen(self, image: torch.Tensor, blur_radius: int, alpha: float): def sharpen(self, image: torch.Tensor, blur_radius: int, alpha: float):
if blur_radius == 0: if blur_radius == 0:
+1 -1
View File
@@ -21,7 +21,7 @@ class Solarize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "solarize_image" FUNCTION = "solarize_image"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def solarize_image(self, image: torch.Tensor, threshold: float): def solarize_image(self, image: torch.Tensor, threshold: float):
solarized_image = torch.where(image > threshold, 1 - image, image) solarized_image = torch.where(image > threshold, 1 - image, image)
+1 -1
View File
@@ -22,7 +22,7 @@ class Vignette:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_vignette" FUNCTION = "apply_vignette"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_vignette(self, image: torch.Tensor, vignette: float): def apply_vignette(self, image: torch.Tensor, vignette: float):
if vignette == 0: if vignette == 0:
+20 -20
View File
@@ -24,7 +24,7 @@ class ArithmeticBlend:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "arithmetic_blend_images" FUNCTION = "arithmetic_blend_images"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def arithmetic_blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_mode: str): def arithmetic_blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_mode: str):
if blend_mode == "add": if blend_mode == "add":
@@ -71,7 +71,7 @@ class Blend:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "blend_images" FUNCTION = "blend_images"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_factor: float, blend_mode: str): def blend_images(self, image1: torch.Tensor, image2: torch.Tensor, blend_factor: float, blend_mode: str):
if image1.shape != image2.shape: if image1.shape != image2.shape:
@@ -149,7 +149,7 @@ class Blur:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "blur" FUNCTION = "blur"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Filters"
def blur(self, image: torch.Tensor, blur_radius: int, sigma: float): def blur(self, image: torch.Tensor, blur_radius: int, sigma: float):
if blur_radius == 0: if blur_radius == 0:
@@ -193,7 +193,7 @@ class CannyEdgeDetection:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "canny" FUNCTION = "canny"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Masks"
def canny(self, image: torch.Tensor, lower_threshold: int, upper_threshold: int): def canny(self, image: torch.Tensor, lower_threshold: int, upper_threshold: int):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
@@ -244,7 +244,7 @@ class ChromaticAberration:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "chromatic_aberration" FUNCTION = "chromatic_aberration"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def chromatic_aberration(self, image: torch.Tensor, red_shift: int, green_shift: int, blue_shift: int, red_direction: str, green_direction: str, blue_direction: str): def chromatic_aberration(self, image: torch.Tensor, red_shift: int, green_shift: int, blue_shift: int, red_direction: str, green_direction: str, blue_direction: str):
def get_shift(direction, shift): def get_shift(direction, shift):
@@ -311,7 +311,7 @@ class ColorCorrect:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "color_correct" FUNCTION = "color_correct"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def color_correct(self, image: torch.Tensor, temperature: float, hue: float, brightness: float, contrast: float, saturation: float, gamma: float): def color_correct(self, image: torch.Tensor, temperature: float, hue: float, brightness: float, contrast: float, saturation: float, gamma: float):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
@@ -388,7 +388,7 @@ class Dissolve:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "dissolve_images" FUNCTION = "dissolve_images"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def dissolve_images(self, image1: torch.Tensor, image2: torch.Tensor, dissolve_factor: float): def dissolve_images(self, image1: torch.Tensor, image2: torch.Tensor, dissolve_factor: float):
dither_pattern = torch.rand_like(image1) dither_pattern = torch.rand_like(image1)
@@ -421,7 +421,7 @@ class DodgeAndBurn:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "dodge_and_burn" FUNCTION = "dodge_and_burn"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Blends"
def dodge_and_burn(self, image: torch.Tensor, mask: torch.Tensor, intensity: float, mode: str): def dodge_and_burn(self, image: torch.Tensor, mask: torch.Tensor, intensity: float, mode: str):
if mode in ["dodge", "color_dodge", "linear_dodge"]: if mode in ["dodge", "color_dodge", "linear_dodge"]:
@@ -500,7 +500,7 @@ class FilmGrain:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "film_grain" FUNCTION = "film_grain"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def film_grain(self, image: torch.Tensor, intensity: float, scale: float, temperature: float, vignette: float): def film_grain(self, image: torch.Tensor, intensity: float, scale: float, temperature: float, vignette: float):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
@@ -633,7 +633,7 @@ class Glow:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_glow" FUNCTION = "apply_glow"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_glow(self, image: torch.Tensor, intensity: float, blur_radius: int): def apply_glow(self, image: torch.Tensor, intensity: float, blur_radius: int):
blurred_image = self.gaussian_blur(image, 2 * blur_radius + 1) blurred_image = self.gaussian_blur(image, 2 * blur_radius + 1)
@@ -678,7 +678,7 @@ class KuwaharaBlur:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_kuwahara_filter" FUNCTION = "apply_kuwahara_filter"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Filters"
def apply_kuwahara_filter(self, image: np.ndarray, blur_radius: int, method: str): def apply_kuwahara_filter(self, image: np.ndarray, blur_radius: int, method: str):
if blur_radius == 0: if blur_radius == 0:
@@ -765,7 +765,7 @@ class Parabolize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "parabolize_image" FUNCTION = "parabolize_image"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def parabolize_image(self, image: torch.Tensor, coeff: float, vertex_x: float, vertex_y: float): def parabolize_image(self, image: torch.Tensor, coeff: float, vertex_x: float, vertex_y: float):
parabolized_image = coeff * torch.pow(image - vertex_x, 2) + vertex_y parabolized_image = coeff * torch.pow(image - vertex_x, 2) + vertex_y
@@ -799,7 +799,7 @@ class PencilSketch:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_sketch" FUNCTION = "apply_sketch"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_sketch(self, image: torch.Tensor, blur_radius: int = 5, sharpen_alpha: float = 1): def apply_sketch(self, image: torch.Tensor, blur_radius: int = 5, sharpen_alpha: float = 1):
image = image.permute(0, 3, 1, 2) # Torch wants (B, C, H, W) we use (B, H, W, C) image = image.permute(0, 3, 1, 2) # Torch wants (B, C, H, W) we use (B, H, W, C)
@@ -882,7 +882,7 @@ class PixelSort:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "sort_pixels" FUNCTION = "sort_pixels"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def sort_pixels(self, image: torch.Tensor, mask: torch.Tensor, direction: str, span_limit: int, sort_by: str, order: str): def sort_pixels(self, image: torch.Tensor, mask: torch.Tensor, direction: str, span_limit: int, sort_by: str, order: str):
horizontal_sort = direction == "horizontal" horizontal_sort = direction == "horizontal"
@@ -922,7 +922,7 @@ class Pixelize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_pixelize" FUNCTION = "apply_pixelize"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_pixelize(self, image: torch.Tensor, pixel_size: int): def apply_pixelize(self, image: torch.Tensor, pixel_size: int):
pixelized_image = self.pixelize_image(image, pixel_size) pixelized_image = self.pixelize_image(image, pixel_size)
@@ -963,7 +963,7 @@ class Quantize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "quantize" FUNCTION = "quantize"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def quantize(self, image: torch.Tensor, colors: int = 256, dither: str = "FLOYDSTEINBERG"): def quantize(self, image: torch.Tensor, colors: int = 256, dither: str = "FLOYDSTEINBERG"):
batch_size, height, width, _ = image.shape batch_size, height, width, _ = image.shape
@@ -1005,7 +1005,7 @@ class Sepia:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "sepia" FUNCTION = "sepia"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def sepia(self, image: torch.Tensor, strength: float): def sepia(self, image: torch.Tensor, strength: float):
if strength == 0: if strength == 0:
@@ -1047,7 +1047,7 @@ class Sharpen:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "sharpen" FUNCTION = "sharpen"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Filters"
def sharpen(self, image: torch.Tensor, blur_radius: int, alpha: float): def sharpen(self, image: torch.Tensor, blur_radius: int, alpha: float):
if blur_radius == 0: if blur_radius == 0:
@@ -1091,7 +1091,7 @@ class Solarize:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "solarize_image" FUNCTION = "solarize_image"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Color Adjustments"
def solarize_image(self, image: torch.Tensor, threshold: float): def solarize_image(self, image: torch.Tensor, threshold: float):
solarized_image = torch.where(image > threshold, 1 - image, image) solarized_image = torch.where(image > threshold, 1 - image, image)
@@ -1119,7 +1119,7 @@ class Vignette:
RETURN_TYPES = ("IMAGE",) RETURN_TYPES = ("IMAGE",)
FUNCTION = "apply_vignette" FUNCTION = "apply_vignette"
CATEGORY = "postprocessing" CATEGORY = "postprocessing/Effects"
def apply_vignette(self, image: torch.Tensor, vignette: float): def apply_vignette(self, image: torch.Tensor, vignette: float):
if vignette == 0: if vignette == 0: