Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image.ANTIALIASING is deprecated and removed from the Pillow library. #3914

Closed
btasdelen opened this issue Jul 4, 2023 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@btasdelen
Copy link

btasdelen commented Jul 4, 2023

As of Pillow 10.0, Image.ANTIALIASING (and its alias Image.LANCZOS) is deprecated and removed. This causes the following error on Xpra:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/xpra/client/client_base.py", line 1152, in call_handler
    handler(packet)
  File "/usr/lib/python3.11/site-packages/xpra/client/mixins/window_manager.py", line 1074, in _process_window_icon
    img = self._window_icon_image(wid, w, h, coding, data)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/xpra/client/mixins/window_manager.py", line 720, in _window_icon_image
    xpra_resized = self.overlay_image.resize((overlay_width, overlay_height), Image.ANTIALIAS)
                                                                              ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

I found two places where Image.ANTIALIAS is called, in xpra/client/mixins/window_manager.py line 710 and 720. Replacing Image.ANTIALIAS with Image.Resampling.LANCZOS seems to solve the issue. I checked the documentation, and this property is introduced in Pillow 1.1.3, so unless Xpra aims to be compatible with older versions of the library, it seems logical to replace them.

Edit: On the latest commit on master branch, line numbers are 763 and 773.

@btasdelen btasdelen added the bug Something isn't working label Jul 4, 2023
@totaam
Copy link
Collaborator

totaam commented Jul 4, 2023

Thanks, the commit above should fix that (untested).
This constant was used in 7 separate files.

@totaam totaam closed this as completed Jul 4, 2023
@btasdelen
Copy link
Author

@totaam Image.LANCZOS is also removed. It should be Image.Resampling.LANCZOS.

totaam added a commit that referenced this issue Jul 4, 2023
@totaam
Copy link
Collaborator

totaam commented Jul 4, 2023

@bilal-tasdelen is the commit above any better?

@btasdelen
Copy link
Author

@totaam Yes, it should work. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants