minimize compression damage with image resize
not sure if it's effective
This commit is contained in:
parent
01ed370ab6
commit
36db9e79dc
|
@ -13,6 +13,7 @@ from telethon.errors.rpcerrorlist import MessageNotModifiedError, UserIsBlockedE
|
||||||
|
|
||||||
log = logging.getLogger('process')
|
log = logging.getLogger('process')
|
||||||
|
|
||||||
|
scale_factor = 1.5
|
||||||
default_vars = {
|
default_vars = {
|
||||||
"sampler_name": "DPM++ 2M Karras",
|
"sampler_name": "DPM++ 2M Karras",
|
||||||
}
|
}
|
||||||
|
@ -173,7 +174,8 @@ class Worker:
|
||||||
|
|
||||||
for fn in images:
|
for fn in images:
|
||||||
img = Image.open(fn)
|
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()
|
imgdata = BytesIO()
|
||||||
img.save(imgdata, format='JPEG')
|
img.save(imgdata, format='JPEG')
|
||||||
siz = imgdata.seek(0,2)
|
siz = imgdata.seek(0,2)
|
||||||
|
|
Loading…
Reference in New Issue