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

module 'PIL.Image' has no attribute 'ANTIALIAS' - resize.py #2002

Closed
yoichitgy opened this issue Jul 5, 2023 · 15 comments
Closed

module 'PIL.Image' has no attribute 'ANTIALIAS' - resize.py #2002

yoichitgy opened this issue Jul 5, 2023 · 15 comments
Labels
bug Issues that report (apparent) bugs. lib-PIL-Pillow Issues pertaining to dependency PIL (or PIL fork Pillow).

Comments

@yoichitgy
Copy link
Contributor

yoichitgy commented Jul 5, 2023

Expected Behavior

resize function works without an error when Pillow version 10.0.0 is installed.

Actual Behavior

The following error is raised at moviepy/video/fx/resize.py", line 37, in resizer

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Steps to Reproduce the Problem

  1. Re-install MoviePy. As its dependency, Pillow version 10.0.0 is installed.
  2. Call resize function on a ImageClip.

This issue is caused by the deprecation of ANTIALIAS in Pillow version 10.0.0.

Reference:
https://stackoverflow.com/a/76616129/4522678

Specifications

  • Python Version: 3.11
  • MoviePy Version: 1.0.3
  • Platform Name: macOS
  • Platform Version: 10.15.7
@yoichitgy yoichitgy added the bug Issues that report (apparent) bugs. label Jul 5, 2023
@keikoro keikoro added the lib-PIL-Pillow Issues pertaining to dependency PIL (or PIL fork Pillow). label Jul 11, 2023
@Mayank19j
Copy link

What should I do in my local to fetch the fix?

@motishaku
Copy link

What should I do in my local to fetch the fix?

did you figure it out?

@delans
Copy link

delans commented Aug 28, 2023

I'm having the same error:

Python Version: 3.11.5
MoviePy Version: 1.0.3
Pillow Version: 10.0.0
Platform Name: macOS
Platform Version: 12.6.7

@bwang514
Copy link

Had the same issues.

After digging into the source code (https://github.com/Zulko/moviepy/blob/master/moviepy/video/fx/resize.py)

I found that moviepy will try to use opencv as resizer first, if opencv not installed it will use PIL which leads to the error we are seeing here.

Instead of fixing the deprecated PIL package, simply installing opencv-python works for me.

@Kaszanas
Copy link

Kaszanas commented Oct 1, 2023

Had the same issues.

After digging into the source code (https://github.com/Zulko/moviepy/blob/master/moviepy/video/fx/resize.py)

I found that moviepy will try to use opencv as resizer first, if opencv not installed it will use PIL which leads to the error we are seeing here.

Instead of fixing the deprecated PIL package, simply installing opencv-python works for me.

Then I suspect that this means that moviepy will add opencv-python as a dependency in future releases?

@COROYO
Copy link

COROYO commented Oct 18, 2023

Had the same issues.
After digging into the source code (https://github.com/Zulko/moviepy/blob/master/moviepy/video/fx/resize.py)
I found that moviepy will try to use opencv as resizer first, if opencv not installed it will use PIL which leads to the error we are seeing here.
Instead of fixing the deprecated PIL package, simply installing opencv-python works for me.

Then I suspect that this means that moviepy will add opencv-python as a dependency in future releases?

yeah i've added openvc-python and everything worked fine.

@paulocoutinhox
Copy link

I have the same error. When moviepy will be fixed to support pil 10? Thanks.

@COROYO
Copy link

COROYO commented Oct 29, 2023

I have the same error. When moviepy will be fixed to support pil 10? Thanks.

Add opencast-python package to your pip

@djkewjrioesjfdwaoikdi
Copy link

I faced the same issue, so i downgraded to Pillow==9.4.0 and it worked for me!

@SohamTilekar
Copy link

The Pil attr ANTIALIAS is Been Deprecated. Therefor We Need to Downgrade the Pillow Version. or Re Download the Moviepy.

@leowasheree
Copy link

You can edit resize.py in line 37 with this line.
resized_pil = pilim.resize(newsize[::-1], resample=Image.LANCZOS)
ANTIALIAS is deprecated.

@SohamTilekar
Copy link

Yes, it can Work But it is Not Suggested.

@leowasheree
Copy link

leowasheree commented Jan 18, 2024

Yeah, but this should work as a temporary solution.

@keikoro
Copy link
Collaborator

keikoro commented Feb 10, 2024

Thanks, @yoichitgy, also for the fix you submitted.

I'm closing this issue – like I've done with the other duplicates – in favour of #2072, which links to the library's official relase notes, to reduce noise.

@keikoro keikoro closed this as completed Feb 10, 2024
@JoelOnyedika
Copy link

So does that mean that for production, i will be forced to make a copy of the entire moviepy repo on my vps, make configs on my dockerfile to edit the resize.py file or downgrade pillow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs. lib-PIL-Pillow Issues pertaining to dependency PIL (or PIL fork Pillow).
Projects
None yet
Development

No branches or pull requests