1
0
forked from ScoDoc/ScoDoc

Merge branch 'sco96' of https://scodoc.org/git/viennet/ScoDoc into sco96

This commit is contained in:
Emmanuel Viennet 2023-08-11 18:46:22 +02:00
commit cef145fa6f
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from PIL import Image as PILImage
def ImageScale(img_file, maxx, maxy): def ImageScale(img_file, maxx, maxy):
im = PILImage.open(img_file) im = PILImage.open(img_file)
im.thumbnail((maxx, maxy), PILImage.ANTIALIAS) im.thumbnail((maxx, maxy), PILImage.LANCZOS)
out_file_str = io.BytesIO() out_file_str = io.BytesIO()
im.save(out_file_str, im.format) im.save(out_file_str, im.format)
out_file_str.seek(0) out_file_str.seek(0)
@ -20,7 +20,7 @@ def ImageScaleH(img_file, W=None, H=90):
if W is None: if W is None:
# keep aspect # keep aspect
W = int((im.size[0] * H) / float(im.size[1])) W = int((im.size[0] * H) / float(im.size[1]))
im.thumbnail((W, H), PILImage.ANTIALIAS) im.thumbnail((W, H), PILImage.LANCZOS)
out_file_str = io.BytesIO() out_file_str = io.BytesIO()
im.save(out_file_str, im.format) im.save(out_file_str, im.format)
out_file_str.seek(0) out_file_str.seek(0)

View File

@ -338,7 +338,7 @@ def scale_height(img, W=None, H=REDUCED_HEIGHT):
if W is None: if W is None:
# keep aspect # keep aspect
W = int((img.size[0] * H) / img.size[1]) W = int((img.size[0] * H) / img.size[1])
img.thumbnail((W, H), PILImage.ANTIALIAS) img.thumbnail((W, H), PILImage.LANCZOS)
return img return img