【PIL】Python PIL旋轉圖片角度

 

一、前言

Python修圖用PIL套件,其中rotate方法可以旋轉圖片。

 

進入基本教學前,不要忘了訂閱按讚分享唷!

部落格教學網站:
https://pixnashpython.pixnet.net/blog
想要即時訂閱最新文章:
https://forms.gle/MdXmiF2HgHhNChL46
訂閱Telegram來接收最新資訊:
https://t.me/joinchat/VUUuDt67Uq5l6CIQ

 

 

二、PIL旋轉圖片


 

from PIL import Image

# 開啟圖片
img = Image.open("logo.png")

# 旋轉圖片
new_img = img.rotate(45) # 旋轉範圍-360 ~ 360度

# 顯示及另存圖片
new_img.show()
new_img.save("new_logo.png")

 

 

三、後記


Python PIL修圖神器!

 

部落格教學網站:
https://pixnashpython.pixnet.net/blog
想要即時訂閱最新文章:
https://forms.gle/MdXmiF2HgHhNChL46
訂閱Telegram來接收最新資訊:
https://t.me/joinchat/VUUuDt67Uq5l6CIQ

arrow
arrow
    創作者介紹
    創作者 恩哥Python 的頭像
    恩哥Python

    恩哥Python量化教室-零基礎也能學會Python

    恩哥Python 發表在 痞客邦 留言(0) 人氣()