From a7382e40c5009eea568ccb8ddaff2e6e652d5b10 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Fri, 23 Feb 2024 23:05:09 +0200 Subject: [PATCH] Update nodes.py --- nodes.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index da94fa6..a24e1d0 100644 --- a/nodes.py +++ b/nodes.py @@ -3642,7 +3642,24 @@ class EffnetEncode: t = effnet(image).cpu() return ({"samples":t}, ) +class ImageNormalize_Neg1_To_1: + @classmethod + def INPUT_TYPES(s): + return {"required": { + "images": ("IMAGE",), + + }} + RETURN_TYPES = ("IMAGE",) + FUNCTION = "normalize" + CATEGORY = "KJNodes" + + def normalize(self,images): + + images = images * 2.0 - 1.0 + + return (images,) + NODE_CLASS_MAPPINGS = { "INTConstant": INTConstant, "FloatConstant": FloatConstant, @@ -3709,7 +3726,8 @@ NODE_CLASS_MAPPINGS = { "CondPassThrough": CondPassThrough, "ImageUpscaleWithModelBatched": ImageUpscaleWithModelBatched, "ScaleBatchPromptSchedule": ScaleBatchPromptSchedule, - "EffnetEncode": EffnetEncode + "EffnetEncode": EffnetEncode, + "ImageNormalize_Neg1_To_1": ImageNormalize_Neg1_To_1 } NODE_DISPLAY_NAME_MAPPINGS = { "INTConstant": "INT Constant", @@ -3776,5 +3794,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "CondPassThrough": "CondPassThrough", "ImageUpscaleWithModelBatched": "ImageUpscaleWithModelBatched", "ScaleBatchPromptSchedule": "ScaleBatchPromptSchedule", - "EffnetEncode": "EffnetEncode" + "EffnetEncode": "EffnetEncode", + "ImageNormalize_Neg1_To_1": "ImageNormalize_Neg1_To_1" } \ No newline at end of file