일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Linux
- TORCH
- Windows
- PostgreSQL
- KAKAO
- docker
- LLM
- AI
- numpy
- Mac
- Container
- judge
- Paper
- format
- GitLab
- Database
- git
- Laravel
- evaluation
- CUDA
- pytorch
- file
- enV
- Python
- DB
- pandas
- Package
- list
- Flask
- Converting
Archives
- Today
- Total
Daily Develope
[Python] Draw Image 이미지 그리기 본문
PIL 모듈 사용
ㅇ 네모박스 삽입 예제
: 이미지파일에 10*20 크기의 박스 삽입 후 저장
from PIL import Image, ImageDraw
### load image
targetImg = "{img_path...}/target.jpg"
img = Image.open(targetImg)
# width, heigth = img.size # image size (width, heigth)
### Draw (width, height)=(10, 20) box from coordinate (x, y)
draw = ImageDraw.Draw(img)
x = 100
y = 100
draw.rectangle(xy=[(x, y), (x+10, y+20)], outline="#00FF00")
img.show()
### Save
savePath = "{save_path...}/update_img.jpg"
img.save(savePath)
img.close()
'Develope > Python' 카테고리의 다른 글
[Anaconda] Python conda 가상환경 (0) | 2022.07.04 |
---|---|
[Python] 시간 측정 (예제코드) (0) | 2022.06.28 |
[Python] 정렬 Sort (Dict, Class) (0) | 2022.04.11 |
[Python] Kakao API 사용예시 (0) | 2022.04.11 |
[Python] 폴더 및 파일 탐색 (0) | 2022.04.06 |