Created
February 14, 2023 22:35
-
-
Save hamaguchi-amago/5aba8ff893ba3bab290ac88125f7aa52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
# Macだとプレビューで開く | |
im = Image.open("cat.jpg") | |
print(im.mode) | |
print(im.size) | |
print(im.width) | |
print(im.height) | |
im.show() | |
# 回転させる | |
im45 = im.rotate(45) | |
im45.show() | |
# (90, 60) のサムネイル | |
im.thumbnail((90, 60)) | |
im.save("cat-thumb.jpg") | |
# JPG -> PNG | |
im = Image.open("cat.jpg") | |
im.save("cat.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ブログのサンプルとして作成しました。
【Python】Pillowライブラリを使って簡単な画像処理を試す
https://neko-py.com/python-image