From f067ad15d139d6e07e44801759f7ccdd9985c636 Mon Sep 17 00:00:00 2001 From: Silver <65376327+silveroxides@users.noreply.github.com> Date: Wed, 4 Sep 2024 01:16:38 +0200 Subject: [PATCH] Make live preview size a configurable launch argument (#4649) * Make live preview size a configurable launch argument * Remove import from testing phase * Update cli_args.py --- comfy/cli_args.py | 2 ++ latent_preview.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/comfy/cli_args.py b/comfy/cli_args.py index 3a0a26d071c..65b879907f6 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -92,6 +92,8 @@ class LatentPreviewMethod(enum.Enum): parser.add_argument("--preview-method", type=LatentPreviewMethod, default=LatentPreviewMethod.NoPreviews, help="Default preview method for sampler nodes.", action=EnumAction) +parser.add_argument("--preview-size", type=int, default=512, help="Sets the maximum preview size for sampler nodes.") + cache_group = parser.add_mutually_exclusive_group() cache_group.add_argument("--cache-classic", action="store_true", help="Use the old style (aggressive) caching.") cache_group.add_argument("--cache-lru", type=int, default=0, help="Use LRU caching with a maximum of N node results cached. May use more RAM/VRAM.") diff --git a/latent_preview.py b/latent_preview.py index ae6c106e44a..e14c72ce4d0 100644 --- a/latent_preview.py +++ b/latent_preview.py @@ -9,7 +9,7 @@ import comfy.utils import logging -MAX_PREVIEW_RESOLUTION = 512 +MAX_PREVIEW_RESOLUTION = args.preview_size def preview_to_image(latent_image): latents_ubyte = (((latent_image + 1.0) / 2.0).clamp(0, 1) # change scale from -1..1 to 0..1