AI 그게 뭔데
끄적끄적 개발일지
AI 그게 뭔데
전체 방문자
오늘
어제
  • 분류 전체보기 (342)
    • 논문 (5)
    • DL(Deep-Learning) (34)
      • 개념 (14)
      • Python 기초 (14)
      • Tensorflow (6)
      • Pytorch (0)
    • NLP (10)
    • OpenCV (53)
    • DevOps (10)
      • AWS (2)
      • Docker & Kubernetes (4)
      • Spark (3)
      • SQL (1)
    • MacOS (1)
    • React-Native (2)
    • BI (3)
      • GA(Google Analytics) (3)
      • Tableau (0)
    • 알고리즘 (221)
      • 백준 (76)
      • 프로그래머스 (108)
      • 기타 알고리즘 (37)

인기 글

태그

  • 연습문제
  • Python
  • 프로그래머스
  • 파이썬
  • 알고리즘
  • LEVEL2
  • OpenCV
  • level1
  • 이코테
  • 백준

최근 글

hELLO · Designed By 정상우.
AI 그게 뭔데

끄적끄적 개발일지

DL(Deep-Learning)/Python 기초

[Python] Convert JPG to PNG (feat. PIL)

2022. 1. 27. 10:31

파이썬의 Pillow 라이브러리를 이용하여 이미지 형식을 바꿔보자.

 

1. Pillow 라이브러리 설치

pip install Pillow

 

 

2. JPG to PNG

from PIL import Image
im = Image.open('hello.jpg').convert('RGB')
im.save('hello_png.png', 'png')

 

 

3. PNG to JPG

from PIL import Image
im = Image.open('hello.png').convert('RGB')
im.save('hello_jpg.jpg', 'jpeg')

 

 

4. 그 외의 형식들

- JPG to WEBP

from PIL import Image
im = Image.open('hello.jpg').convert('RGB')
im.save('hello_webp.webp', 'webp')

 

 

- PNG to WEBP

from PIL import Image
im = Image.open('hello.png').convert('RGB')
im.save('hello_webp.webp', 'webp')

Convert

'DL(Deep-Learning) > Python 기초' 카테고리의 다른 글

[Python] DataFrame 데이터 타입 변환하기  (0) 2022.01.27
Google Colab 런타임 연결 유지 & 출력 삭제  (0) 2022.01.26
[Python] 파일 이름 변경하기  (0) 2022.01.26
DataFrame 합치기2 (concat, merge, join)  (0) 2022.01.26
DataFrame 합치기1 (concat, merge, join)  (0) 2022.01.26
    AI 그게 뭔데
    AI 그게 뭔데
    공부와 개발 그리고 AI가 약간 첨가된 흔적 남기기

    티스토리툴바