티스토리 뷰
Skills/Error
[Error] AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
Suyeon Cha 2024. 1. 18. 02:46728x90
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
이런 에러가 발생하는 이유는 Python의 pillow package에 해당 모듈이 없다는 오류입니다. version에 따라 모듈이 삭제되기도 하는데, pillow 10.0.0에서는 'ANTIALIAS'의 모듈이 제거되었고, 'PIL.Image.LANCZOS' 또는 'PIL.Image.Resampling.LANCZOS'를 사용해야 합니다.
원래의 알고리즘과 동일하여서 파일 내에서 수정을 하여도 되고,
import PIL
import numpy as np
# Gradient image with a sharp color boundary across the diagonal
large_arr = np.fromfunction(lambda x, y, z: (x+y)//(z+1),
(256, 256, 3)).astype(np.uint8)
large_img = PIL.Image.fromarray(large_arr)
# Resize it: PIL.Image.LANCZOS also works here
small_img = large_img.resize((128, 128), PIL.Image.Resampling.LANCZOS)
print(small_img.size)
large_img.show()
small_img.show()
pillow의 버전을 낮추어도 상관이 없다면
pip uninstall Pillow
pip install Pillow==9.5.0
OR
pip3 install "Pillow<10.0.0"
이 방법으로 해결할 수 있습니다.
또는 파이썬 스크립트에서
import PIL PIL.Image.ANTIALIAS = PIL.Image.LANCZOS
이렇게 수정하여도 된다고 합니다.
전 버전을 낮춰서 해결하였습니다.
728x90
'Skills > Error' 카테고리의 다른 글
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 파이썬 클래스 계층 구조
- style transfer
- linux nano
- cs231n
- 리눅스 나노
- docker
- 파이썬
- few-shot learning
- 딥러닝
- Unsupervised learning
- Prompt
- 서버구글드라이브연동
- 도커 컨테이너
- prompt learning
- 도커
- 파이썬 딕셔너리
- support set
- 파이썬 클래스 다형성
- NLP
- 리눅스
- clip
- 리눅스 nano
- CNN
- 프롬프트
- 구글드라이브연동
- python
- 리눅스 나노 사용
- 퓨샷러닝
- 도커 작업
- stylegan
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함
250x250