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)文章
用Python獲取攝像頭并實時控制人臉的實現(xiàn)示例
這篇文章主要介紹了用Python獲取攝像頭并實時控制人臉的實現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07
Python庫學(xué)習(xí)Tkinter制作GUI個性簽名設(shè)計軟件
Tkinter 是 Python 中的標(biāo)準(zhǔn) GUI 庫,使用 Tkinter 可以快速地創(chuàng)建 GUI 應(yīng)用程序。今天我們打算再用一個小案例,帶大家加深對Tkinter的理解2021-09-09

