From 36db9e79dc2eb53a5013d8727b2f89f0c42ce212 Mon Sep 17 00:00:00 2001 From: nameless Date: Tue, 15 Aug 2023 18:45:31 +0000 Subject: [PATCH] minimize compression damage with image resize not sure if it's effective --- process_queue.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/process_queue.py b/process_queue.py index c92944c..4bf26b2 100644 --- a/process_queue.py +++ b/process_queue.py @@ -13,6 +13,7 @@ from telethon.errors.rpcerrorlist import MessageNotModifiedError, UserIsBlockedE log = logging.getLogger('process') +scale_factor = 1.5 default_vars = { "sampler_name": "DPM++ 2M Karras", } @@ -173,7 +174,8 @@ class Worker: for fn in images: img = Image.open(fn) - img.thumbnail((1280,1280)) + width, height = img.size + img = img.resize((int(width * scale_factor), int(height * scale_factor))) imgdata = BytesIO() img.save(imgdata, format='JPEG') siz = imgdata.seek(0,2)