본문 바로가기

프로그래밍

python 이미지 크롭

  • 특정 사이즈 이미지 크롭
from PIL import Image

img = Image.open("")

area = (100,100,200,200) ## (가로시작점, 세로시작점, 가로시작점+ 원하는 가로 crop길이, 세로시작점+원하는 세로 crop길이)

crop_img = img.crop(area)

crop_img.show()
crop_img.save('test.jpg') ## 저장할 파일명

'프로그래밍' 카테고리의 다른 글

python class 정리  (0) 2020.05.25
pandas 까먹는것들  (0) 2020.05.15
numpy array와 python list 차이  (0) 2020.05.13
python array  (0) 2020.05.13
자주쓰는 python  (0) 2020.05.13