From f072af3991ed8dda2fdbe67222527ed0f3801257 Mon Sep 17 00:00:00 2001 From: Fictiverse <111762798+Fictiverse@users.noreply.github.com> Date: Fri, 26 Dec 2025 02:34:05 +0100 Subject: [PATCH] Add files via upload --- nodes/FV_GetImageHalfSize.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 nodes/FV_GetImageHalfSize.py diff --git a/nodes/FV_GetImageHalfSize.py b/nodes/FV_GetImageHalfSize.py new file mode 100644 index 0000000..aabc84a --- /dev/null +++ b/nodes/FV_GetImageHalfSize.py @@ -0,0 +1,35 @@ +class FV_GetImageHalfSize: + def __init__(self): + pass + + @classmethod + def INPUT_TYPES(cls): + return { + "required": { + "image": ("IMAGE",), + } + } + + RETURN_TYPES = ("INT", "INT") + RETURN_NAMES = ("width", "height") + FUNCTION = "run" + CATEGORY = "Fictiverse/Resize" + + def run(self, image): + # image est un batch : (batch, height, width, channels) + first_image = image[0] + + height = first_image.shape[0] + width = first_image.shape[1] + + if width >= height: + width = width // 2 + else: + height = height // 2 + + return (width, height) + + +NODE_CLASS_MAPPINGS = { + "FV Get Image Half Size": FV_GetImageHalfSize +}