Files
EllangoK 34dfeb316c puts nodes in sub menus
unfortunately breaks previous, but I should have done this from start
2023-05-06 16:25:35 -04:00

46 lines
1.3 KiB
Python

import torch
class Parabolize:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image": ("IMAGE",),
"coeff": ("FLOAT", {
"default": 1.0,
"min": -10.0,
"max": 10.0,
"step": 0.1
}),
"vertex_x": ("FLOAT", {
"default": 0.5,
"min": 0.0,
"max": 1.0,
"step": 0.1
}),
"vertex_y": ("FLOAT", {
"default": 0.5,
"min": 0.0,
"max": 1.0,
"step": 0.1
}),
},
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "parabolize_image"
CATEGORY = "postprocessing/Color Adjustments"
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 = torch.clamp(parabolized_image, 0, 1)
return (parabolized_image,)
NODE_CLASS_MAPPINGS = {
"Parabolize": Parabolize,
}