diff --git a/misc.py b/misc.py index 9a0670e..ce1eb9e 100644 --- a/misc.py +++ b/misc.py @@ -472,17 +472,21 @@ def INPUT_TYPES(s): "batch_size": ("INT", {"default": 1, "min": 1, "max": 4096}), "width_override": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 8}), "height_override": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 8}), + "resolution_multiplier": ("FLOAT", {"default": 1, "min": 0, "max": 100, "step": 0.5}), }} RETURN_TYPES = ("LATENT","INT","INT",) RETURN_NAMES = ("LATENT","width","height",) - FUNCTION = "execute" - CATEGORY = "essentials/utilities" + FUNCTION = "execute" + CATEGORY = "essentials/utilities" - def execute(self, resolution, batch_size, width_override=0, height_override=0): + def execute(self, resolution, batch_size, width_override=0, height_override=0, resolution_multiplier=1.0): width, height = resolution.split(" ")[0].split("x") - width = width_override if width_override > 0 else int(width) - height = height_override if height_override > 0 else int(height) + width = width_override if width_override > 0 else int(width) + height = height_override if height_override > 0 else int(height) + + width = int(resolution_multiplier * width) + height = int(resolution_multiplier * height) latent = torch.zeros([batch_size, 4, height // 8, width // 8], device=self.device) @@ -571,4 +575,4 @@ def tensorShape(tensor): "SimpleMathPercent+": "🔧 Simple Math Percent", "SimpleMathSlider+": "🔧 Simple Math Slider", "SimpleMathSliderLowRes+": "🔧 Simple Math Slider low-res", -} \ No newline at end of file +}