Skip to content

Commit

Permalink
settings: Replace PIL.Image.ANTIALIAS with PIL.Image.LANCZOS.
Browse files Browse the repository at this point in the history
LANCZOS is already available in current pillow versions, so there are
no compatibility issues.

Fixes #11746.
  • Loading branch information
mtwebster committed Jul 7, 2023
1 parent 86bfdbf commit fce9aad
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def _on_face_browse_menuitem_activated(self, menuitem):
if response == Gtk.ResponseType.OK:
path = dialog.get_filename()
image = PIL.Image.open(path)
image.thumbnail((96, 96), Image.ANTIALIAS)
image.thumbnail((96, 96), Image.LANCZOS)
face_path = os.path.join(user.get_home_dir(), ".face")
try:
try:
Expand Down
2 changes: 1 addition & 1 deletion files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def create_corner(radius=100, opacity=255, factor=2):
draw = ImageDraw.Draw(corner)
draw.pieslice((0, 0, 2 * factor * radius, 2 * factor * radius),
180, 270, fill=opacity)
corner = corner.resize((radius, radius), Image.ANTIALIAS)
corner = corner.resize((radius, radius), Image.LANCZOS)
return corner

def get_format(ext):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ def get_pix(self, filename, size=None):
img = Image.alpha_composite(bg_img, img)
img = img.convert("RGB")
if size:
img.thumbnail((size, size), Image.ANTIALIAS)
img.thumbnail((size, size), Image.LANCZOS)

import imtools
img = imtools.round_image(img, {}, False, None, 3, 255)
Expand Down
4 changes: 2 additions & 2 deletions files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _on_face_photo_menuitem_activated(self, menuitem):
bottom = (height + new_height) / 2

image = image.crop((left, top, right, bottom))
image.thumbnail((255, 255), Image.ANTIALIAS)
image.thumbnail((255, 255), Image.LANCZOS)

face_path = os.path.join(self.accountService.get_home_dir(), ".face")

Expand Down Expand Up @@ -202,7 +202,7 @@ def _on_face_browse_menuitem_activated(self, menuitem):
if response == Gtk.ResponseType.OK:
path = dialog.get_filename()
image = Image.open(path)
image.thumbnail((255, 255), Image.ANTIALIAS)
image.thumbnail((255, 255), Image.LANCZOS)
face_path = os.path.join(self.accountService.get_home_dir(), ".face")
image.save(face_path, "png")
self.accountService.set_icon_file(face_path)
Expand Down

0 comments on commit fce9aad

Please sign in to comment.