sczhou / CodeFormer

[NeurIPS 2022] Towards Robust Blind Face Restoration with Codebook Lookup Transformer
Other
15.03k stars 3.21k forks source link

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

Open ErfanBahramali opened 1 year ago

ErfanBahramali commented 1 year ago

Error:

Traceback (most recent call last):
  File "scripts/crop_align_face.py", line 205, in <module>
    size_ = align_face(in_path, out_path)
  File "scripts/crop_align_face.py", line 177, in align_face
    img = img.resize((output_size, output_size), PIL.Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

The problem is from Pillow version 10.0.0 ANTIALIAS was removed in Pillow 10.0.0 Now you need to use PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS Or specify Pillow version in requirements.txt

Pillow==9.5.0

https://stackoverflow.com/questions/76616042/attributeerror-module-pil-image-has-no-attribute-antialias

wonghin commented 11 months ago

I am also facing this problem and have already followed the intruction. Even you have changed the property from PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS, the output image will be the same as the input.

wonghin commented 10 months ago

Finally, try pip install Pillow==9.4.0 in codeformer conda env. The problem will be solved