python简单实现旋转图片的方法


Posted in Python onMay 30, 2015

本文实例讲述了python简单实现旋转图片的方法。分享给大家供大家参考。具体实现方法如下:

# 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程序设计有所帮助。

Python 相关文章推荐
Python使用新浪微博API发送微博的例子
Apr 10 Python
跟老齐学Python之不要红头文件(1)
Sep 28 Python
在Python中使用cookielib和urllib2配合PyQuery抓取网页信息
Apr 25 Python
python删除列表内容
Aug 04 Python
对numpy中shape的深入理解
Jun 15 Python
python正则-re的用法详解
Jul 28 Python
python 安装库几种方法之cmd,anaconda,pycharm详解
Apr 08 Python
Python如何实现定时器功能
May 28 Python
python 爬取腾讯视频评论的实现步骤
Feb 18 Python
python 实现两个变量值进行交换的n种操作
Jun 02 Python
Python实现DBSCAN聚类算法并样例测试
Jun 22 Python
Python学习开发之图形用户界面详解
Aug 23 Python
Python实现控制台输入密码的方法
May 29 #Python
python删除过期文件的方法
May 29 #Python
Python的Django框架中TEMPLATES项的设置教程
May 29 #Python
编写Python脚本把sqlAlchemy对象转换成dict的教程
May 29 #Python
Python fileinput模块使用实例
May 28 #Python
Python sys.argv用法实例
May 28 #Python
Python中exit、return、sys.exit()等使用实例和区别
May 28 #Python
You might like
PHP对表单提交特殊字符的过滤和处理方法汇总
2014/02/18 PHP
php新浪微博登录接口用法实例
2014/12/23 PHP
PHP遍历数组的方法汇总
2015/04/30 PHP
以实例全面讲解PHP中多进程编程的相关函数的使用
2015/08/18 PHP
学习php设计模式 php实现装饰器模式(decorator)
2015/12/07 PHP
php并发加锁问题分析与设计代码实例讲解
2021/02/26 PHP
javascript之dhDataGrid Ver2.0.0代码
2007/07/01 Javascript
jQuery的.live()和.die() 使用介绍
2011/09/10 Javascript
Jquery 数据选择插件Pickerbox使用介绍
2012/08/24 Javascript
基于JQuery的一句话搞定手风琴菜单
2012/09/14 Javascript
javascript 手动给表增加数据的小例子
2013/07/10 Javascript
js返回上一页并刷新的多种实现方法
2014/02/26 Javascript
js实现鼠标触发图片抖动效果的方法
2015/02/27 Javascript
js实现漂浮回顶部按钮实例
2015/05/06 Javascript
js控制文本框输入的字符类型方法汇总
2015/06/19 Javascript
如何防止JavaScript自动插入分号
2015/11/05 Javascript
关于JS与jQuery中的文档加载问题
2017/08/22 jQuery
Angular4学习笔记之根模块与Ng模块
2017/09/09 Javascript
vue小图标favicon不显示的解决方案
2017/09/19 Javascript
vue项目中的webpack-dev-sever配置方法
2017/12/14 Javascript
webpack手动配置React开发环境的步骤
2018/07/02 Javascript
VueQuillEditor富文本上传图片(非base64)
2020/06/03 Javascript
针对Vue路由history模式下Nginx后台配置操作
2020/10/22 Javascript
Python 过滤字符串的技巧,map与itertools.imap
2008/09/06 Python
python获取元素在数组中索引号的方法
2015/07/15 Python
python中numpy基础学习及进行数组和矢量计算
2017/02/12 Python
python 普通克里金(Kriging)法的实现
2019/12/19 Python
英国领先的亚洲旅游专家:Wendy Wu Tours
2018/01/21 全球购物
阿迪达斯越南官网:adidas越南
2020/07/19 全球购物
数据库面试要点基本概念
2013/10/31 面试题
旅游专业职业生涯规划范文
2014/01/13 职场文书
会计专业自我鉴定
2014/02/10 职场文书
保护环境建议书400字
2014/05/13 职场文书
销售顾问工作计划书
2014/08/15 职场文书
2019送给家人们的中秋节祝福语
2019/08/15 职场文书
解决Jenkins集成SonarQube遇到的报错问题
2021/07/15 Java/Android