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

(Pillow Error) AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #4

Open
ShivamA96 opened this issue Sep 21, 2023 · 2 comments

Comments

@ShivamA96
Copy link

def __init__(self, image_path: str) -> None:
        self.image_path = image_path
        self.image = Image.open(self.image_path)
        self.dominant_color: str = ""
        self.r: int = 0
        self.g: int = 0
        self.b: int = 0
        self.l: int = 0
        self.resized_image = self.image.resize(
            **(DominantColor.resize_value, DominantColor.resize_value), Image.ANTIALIAS**
        ).convert("RGBA")
        self.image.close()
        self.image_data = self.resized_image.getdata()
        self.generate_dominant_color_of_pixels_of_image_array()
        self.resized_image.close()

@gilbert-houtekamer
Copy link

I get the same error, copilot sys:

[The error message you’re encountering indicates that the attribute 'ANTIALIAS' is no longer available in Pillow (PIL) starting from version 10.0.0. Instead, you should use 'LANCZOS' for antialiasing when resizing images.

@Demmenie
Copy link

Demmenie commented Jul 3, 2024

I have fixed this in my fork of this package called "imagedominantcolour":
https://github.com/Demmenie/imagedominantcolour
https://pypi.org/project/imagedominantcolour/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants