From 19a9c61cadedea372919828f01fdfcedfa7c61de Mon Sep 17 00:00:00 2001 From: AngelBottomless Date: Tue, 16 Jul 2024 18:35:57 +0900 Subject: [PATCH] add Invert Image Node --- io_node.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/io_node.py b/io_node.py index 26911cb..f923e07 100644 --- a/io_node.py +++ b/io_node.py @@ -10,6 +10,7 @@ from .autonode import node_wrapper, get_node_names_mappings, validate, anytype, import time import os from PIL import Image +from PIL import ImageOps from PIL import ImageEnhance from PIL.PngImagePlugin import PngInfo import piexif @@ -364,6 +365,24 @@ class ResizeImageResolution: "method": (["NEAREST", "LANCZOS", "BICUBIC"],), }, } +@fundamental_node +class InvertImageNode: + FUNCTION = "invert_image" + RETURN_TYPES = ("IMAGE",) + CATEGORY = "image" + custom_name = "Invert Image" + @staticmethod + @PILHandlingHodes.output_wrapper + def invert_image(image): + image = PILHandlingHodes.handle_input(image) + return (ImageOps.invert(image),) + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ("IMAGE",), + } + } @fundamental_node class ResizeScaleImageNode: