From 8a35c12e8c2dcac25ab1dcaba5bd832c278dcce4 Mon Sep 17 00:00:00 2001 From: m957ymj75urz Date: Sun, 26 Mar 2023 13:10:20 +0200 Subject: [PATCH] compute %width% and %height% in filepath when saving --- nodes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nodes.py b/nodes.py index a981abb..bec2bf9 100644 --- a/nodes.py +++ b/nodes.py @@ -746,6 +746,13 @@ class SaveImage: except: digits = 0 return (digits, prefix) + + def compute_vars(input): + input = input.replace("%width%", str(images[0].shape[1])) + input = input.replace("%height%", str(images[0].shape[0])) + return input + + filename_prefix = compute_vars(filename_prefix) subfolder = os.path.dirname(os.path.normpath(filename_prefix)) filename = os.path.basename(os.path.normpath(filename_prefix))