minimize compression damage with image resize

not sure if it's effective
This commit is contained in:
nameless 2023-08-15 18:45:31 +00:00
parent 01ed370ab6
commit 36db9e79dc
1 changed files with 3 additions and 1 deletions

View File

@ -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)