1.5 KiB
1.5 KiB
Documentation
- Class name: ColorCorrectGamma
- Category: 😺dzNodes/LayerColor
- Output node: False
- Repo Ref: https://github.com/chflame163/ComfyUI_LayerStyle
改变图像的Gamma值。
Input types
Required
-
image
- 输入的图片。
- Comfy dtype: IMAGE
- Python dtype: torch.Tensor
-
gamma
- 图像的Gamma值。
- Comfy dtype: FLOAT
- Python dtype: float
Output types
- image
- 输出的图片。
- Comfy dtype: IMAGE
- Python dtype: torch.Tensor
Usage tips
- Infra type: GPU
Source code
class ColorCorrectGamma:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(self):
return {
"required": {
"image": ("IMAGE", ),
"gamma": ("FLOAT", {"default": 1, "min": 0.1, "max": 10, "step": 0.01}),
},
"optional": {
}
}
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
FUNCTION = 'color_correct_gamma'
CATEGORY = '😺dzNodes/LayerColor'
def color_correct_gamma(self, image, gamma):
ret_images = []
for i in image:
i = torch.unsqueeze(i, 0)
__image = tensor2pil(i)
ret_image = gamma_trans(tensor2pil(i), gamma)
if __image.mode == 'RGBA':
ret_image = RGB2RGBA(ret_image, __image.split()[-1])
ret_images.append(pil2tensor(ret_image))
log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish')
return (torch.cat(ret_images, dim=0),)