Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

compute %width% and %height% in filepath when saving

m957ymj75urz8a35c12e8c2d
diff --git a/nodes.py b/nodes.py
index a981abb8e..bec2bf9a7 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))