add option to CLI and pngwriter that allows user to set PNG compression level

- In CLI: the argument is --png_compression <0..9> (-z<0..9>)
- In API, pass `compress_level` to PngWriter.save_image_and_prompt_to_png()

Compression ranges from 0 (no compression) to 9 (maximum compression).
Default value is 6 (as specified by Pillow package).

This addresses an issue first raised in #652.
This commit is contained in:
Lincoln Stein
2022-10-16 11:50:59 -04:00
parent 9e599c65c5
commit 0cf11ce488
5 changed files with 22 additions and 2 deletions

View File

@ -270,6 +270,7 @@ def main_loop(gen, opt, infile):
model_hash = gen.model_hash,
),
name = filename,
compress_level = opt.png_compression,
)
# update rfc metadata