Python PIL库 教程
来源:互联网 发布:淘宝卖家营销分析 编辑:程序博客网 时间:2024/05/26 12:54
使用Image类:
1.从文件中加载图片,要使用Image模块里的open函数
>>>import Image>>>im = Image.open("2.jpg")windows下要用‘\\’,否则会报错
>>>import Image>>>im = Image.open("C:\\Users\\G\\Desktop\\Python\\2.jpg")
2.上述操作成功的话,函数会返回一个Image对象,你可以查看对象的信息
>>>print im.format, im.size, im.modeJPEG (1000, 1000) RGB
3.缩放图像
>>>W,H=im.size #获取宽和高
>>>im.thumbnail((W//2,H//2)) #使用thumbnail函数缩放
4.保存
>>>im.save('C:\\Users\\G\\Desktop\\Python\\l_2.jpg', 'jpeg')
5.模糊
import Image,ImageFilterim = Image.open('C:\\Users\\G\\Desktop\\Python\\2.jpg')im.filter(ImageFilter.BLUR)
to be continnued
阅读全文
0 0
- Python PIL库 教程
- PIL (Python Imaging Library) 教程
- python中PIL安装教程
- PIL (Python Imaging Library) 教程
- python PIL库安装
- Python PIL库总结
- python PIL库详解
- python进阶之PIL 简明教程
- PIL 教程
- Python图像处理库 PIL
- python的PIL库安装
- python安装图形库PIL
- PIL python图像处理库
- python PIL
- python PIL
- python,PIL
- python-PIL
- python-PIL
- python-pandas的基本用法02
- 数据库分库分表(sharding)---全局主键生成策略
- [python]反转英文句子
- 关于构造函数和析构函数调用时的多种情况
- Linux守护进程
- Python PIL库 教程
- 设计模式--中介者模式
- ajax返回函数json数据如何取值问题
- 各类识别、深度学习 开源代码及文献梳理
- 照片采集信息 Excel表单处理 VBA
- SLAM学习——建图(二)
- 程序员面试-操作系统-进程
- D.4乱玩数字
- javascript正则表达式