fix 'PIL.Image' has no attribute 'ANTIALIAS'

```
Traceback (most recent call last):
  File "\ultimatevocalremovergui\UVR.py", line 7288, in <module>
    root = MainWindow()
  File "\ultimatevocalremovergui\UVR.py", line 1350, in __init__
    img = ImagePath(BASE_PATH)
  File "\ultimatevocalremovergui\gui_data\app_size_values.py", line 95, in __init__
    self.efile_img = self.open_image(path=efile_path,size=(image_scale_1, image_scale_1))
  File "\ultimatevocalremovergui\gui_data\app_size_values.py", line 135, in open_image
    img = img.resize((size[0], int(size[0] * ratio)), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
```
ANTIALIAS was removed in Pillow 10.0.0 (after being deprecated through many previous versions). Now you need to use PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS.

(This is the exact same algorithm that ANTIALIAS referred to, you just can no longer access it through the name ANTIALIAS.)
This commit is contained in:
normalllll 2024-04-02 20:07:25 +08:00 committed by GitHub
parent f81dfec089
commit 01128baa2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,9 +132,9 @@ class ImagePath():
if size is not None:
size = (int(size[0]), int(size[1]))
if keep_aspect:
img = img.resize((size[0], int(size[0] * ratio)), Image.ANTIALIAS)
img = img.resize((size[0], int(size[0] * ratio)), Image.Resampling.LANCZOS)
else:
img = img.resize(size, Image.ANTIALIAS)
img = img.resize(size, Image.Resampling.LANCZOS)
return ImageTk.PhotoImage(img)