Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.1k stars 1.51k forks source link

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

Closed yoichitgy closed 4 months ago

yoichitgy commented 1 year ago

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

Mayank19j commented 10 months ago

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

motishaku commented 10 months ago

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

did you figure it out?

delans commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

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 commented 8 months ago

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 commented 8 months ago

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

COROYO commented 8 months ago

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

Add opencast-python package to your pip

djkewjrioesjfdwaoikdi commented 6 months ago

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

SohamTilekar commented 6 months ago

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

SH1NSETSU commented 5 months ago

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

SohamTilekar commented 5 months ago

Yes, it can Work But it is Not Suggested.

SH1NSETSU commented 5 months ago

Yeah, but this should work as a temporary solution.

keikoro commented 4 months ago

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.