From cc127eeabd5cdd42f1a472e43938c6a202e89626 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Thu, 23 Mar 2023 00:40:48 -0400 Subject: [PATCH] Lower PNG compression for more speed. After some quick tests compress_level=4 seems to give the best compression performance ratio for stable diffusion images. It's 10x faster than max compression for an image size increase of only 2.5%. --- nodes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes.py b/nodes.py index 530f4cea..0b8be765 100644 --- a/nodes.py +++ b/nodes.py @@ -779,7 +779,7 @@ class SaveImage: metadata.add_text(x, json.dumps(extra_pnginfo[x])) file = f"{filename}_{counter:05}_.png" - img.save(os.path.join(full_output_folder, file), pnginfo=metadata, optimize=True) + img.save(os.path.join(full_output_folder, file), pnginfo=metadata, compress_level=4) results.append({ "filename": file, "subfolder": subfolder,