python簡單實現(xiàn)旋轉(zhuǎn)圖片的方法
更新時間:2015年05月30日 10:08:52 作者:皮蛋
這篇文章主要介紹了python簡單實現(xiàn)旋轉(zhuǎn)圖片的方法,涉及Python中image模塊使用技巧,需要的朋友可以參考下
本文實例講述了python簡單實現(xiàn)旋轉(zhuǎn)圖片的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
# rotate an image counter-clockwise using the PIL image library
# free from: http://www.pythonware.com/products/pil/index.htm
# make sure to install PIL after your regular python package is installed
import Image
# open an image file (.bmp,.jpg,.png,.gif)
# change image filename to something you have in the working folder
im1 = Image.open("Donald.gif")
# rotate 60 degrees counter-clockwise
im2 = im1.rotate(60)
# brings up the modified image in a viewer, simply saves the image as
# a bitmap to a temporary file and calls viewer associated with .bmp
# make certain you have an image viewer associated with this file type
im2.show()
# save the rotated image as d.gif to the working folder
# you can save in several different image formats, try d.jpg or d.png
# PIL is pretty powerful stuff and figures it out from the extension
im2.save("d.gif")
希望本文所述對大家的Python程序設(shè)計有所幫助。
相關(guān)文章
解決jupyter notebook打不開無反應(yīng) 瀏覽器未啟動的問題
這篇文章主要介紹了解決jupyter notebook打不開無反應(yīng) 瀏覽器未啟動的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-04-04
python使用smtplib模塊通過gmail實現(xiàn)郵件發(fā)送的方法
這篇文章主要介紹了python使用smtplib模塊通過gmail實現(xiàn)郵件發(fā)送的方法,涉及Python使用smtplib模塊發(fā)送郵件的相關(guān)技巧,非常簡單實用,需要的朋友可以參考下2015-05-05
Python中json.dumps()函數(shù)的使用解析
json.dumps將一個Python數(shù)據(jù)結(jié)構(gòu)轉(zhuǎn)換為JSON,本文介紹了Python中json.dumps()函數(shù)的具體使用方法,以及和dump的區(qū)別,感興趣的可以了解一下2021-05-05
python for循環(huán)內(nèi)輸出和外輸出方式
這篇文章主要介紹了python for循環(huán)內(nèi)輸出和外輸出方式,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2021-03-03

