chore(deps): Bump Pillow from 9.0.1 to 9.1.1

Includes security fixes, API & constants deprecations

Changelog: https://pillow.readthedocs.io/en/stable/releasenotes/index.html
This commit is contained in:
Gavin D'souza 2022-06-02 13:03:57 +05:30
parent 111ad3cc82
commit fc422f4a97
4 changed files with 6 additions and 8 deletions

View file

@ -341,9 +341,9 @@ class File(Document):
size = width, height
if crop:
image = ImageOps.fit(image, size, Image.ANTIALIAS)
image = ImageOps.fit(image, size, Image.Resampling.LANCZOS)
else:
image.thumbnail(size, Image.ANTIALIAS)
image.thumbnail(size, Image.Resampling.LANCZOS)
thumbnail_url = f"{filename}_{suffix}.{extn}"
path = os.path.abspath(frappe.get_site_path("public", thumbnail_url.lstrip("/")))

View file

@ -1349,7 +1349,7 @@ def get_thumbnail_base64_for_image(src):
original_size = image.size
size = 50, 50
image.thumbnail(size, Image.ANTIALIAS)
image.thumbnail(size, Image.Resampling.LANCZOS)
base64_string = image_to_base64(image, extn)
return {

View file

@ -7,8 +7,6 @@ from PIL import Image
def resize_images(path, maxdim=700):
from PIL import Image
size = (maxdim, maxdim)
for basepath, folders, files in os.walk(path):
for fname in files:
@ -16,7 +14,7 @@ def resize_images(path, maxdim=700):
if extn in ("jpg", "jpeg", "png", "gif"):
im = Image.open(os.path.join(basepath, fname))
if im.size[0] > size[0] or im.size[1] > size[1]:
im.thumbnail(size, Image.ANTIALIAS)
im.thumbnail(size, Image.Resampling.LANCZOS)
im.save(os.path.join(basepath, fname))
print("resized {0}".format(os.path.join(basepath, fname)))
@ -56,7 +54,7 @@ def optimize_image(
image = Image.open(io.BytesIO(content))
image_format = content_type.split("/")[1]
size = max_width, max_height
image.thumbnail(size, Image.LANCZOS)
image.thumbnail(size, Image.Resampling.LANCZOS)
output = io.BytesIO()
image.save(

View file

@ -33,7 +33,7 @@ parse~=1.19.0
passlib~=1.7.4
paytmchecksum~=1.7.0
pdfkit~=1.0.0
Pillow~=9.0.0
Pillow~=9.1.1
premailer~=3.8.0
psutil~=5.9.1
psycopg2-binary~=2.9.1