CodeFormer
CodeFormer copied to clipboard
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
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
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.
Finally, try pip install Pillow==9.4.0 in codeformer conda env. The problem will be solved