import os
from PIL import Image
path = 'E:\\폴더\\' # 원본 폴더
resultPath = 'E:\\폴더' # 결과 폴더(새로 저장할)
# if not os.path.exists(resultPath):
# os.mkdir(resultPath)
list = os.listdir(path)
list.sort()
for filename in list:
file = path + filename
img = Image.open(file)
img.save(os.path.join(resultPath, filename), 'JPEG', qualty=50) # 품질 55로 줄이면서 용량 ↓'Python > 기능' 카테고리의 다른 글
| 파이썬(python) - 파일 이름 변경 (0) | 2022.05.03 |
|---|---|
| 폴더에서 원하는 확장자 파일 삭제 (0) | 2021.12.24 |
| 원하는 폴더들 띄우기 (0) | 2021.12.24 |
| 알집폴더 풀기 (0) | 2021.12.24 |
| OpenCV) 이미지 이동 (0) | 2021.11.29 |