Python PIL库之Image注解(API)
http://blog.csdn.net/xiezhiyong3621/article/details/8499543
class Image
Methods defined here:
__getattr__(self, name)
__init__(self)
__repr__(self)
convert(self, mode=None, data=None, dither=None, palette=0, colors=256)
Convert to other pixel format
copy(self)
Copy raster data
复制一个新的对象
crop(self, box=None)
Crop region from image
draft(self, mode, size)
Configure image decoder
filter(self, filter)
Apply environment filter to image
fromstring(self, data, decoder_name='raw', *args)
Load data to image from binary string
从原始图像数据中加载图像,一般用来从剪切板中获取图像
getbands(self)
Get band names
getbbox(self)
Get bounding box of actual data (non-zero pixels) in image
获取当前图像在实际图片中的范围
getcolors(self, maxcolors=256)
Get colors from image, up to given limit
getdata(self, band=None)
Get image data as sequence object.
获取图像数据列表。如果指定band,就获取这个颜色通道的值得列表
1.print im.getdata()[0]
2.(253,23,34)
getextrema(self)
Get min/max value
getim(self)
Get PyCObject pointer to internal image memory
getpalette(self)
Get palette contents.
getpixel(self, xy)
Get pixel value
获取每个坐标像素点的RGB值。参数xy格式为(x,y)
getprojection(self)
Get projection to x and y axes
histogram(self, mask=None, extrema=None)
Take histogram of image
load(self)
Explicitly load pixel data.
offset(self, xoffset, yoffset=None)
(deprecated) Offset image in horizontal and/or vertical direction
paste(self, im, box=None, mask=None)
Paste other image into region
point(self, lut, mode=None)
Map image through lookup table
putalpha(self, alpha)
Set alpha layer
putdata(self, data, scale=1.0, offset=0.0)
Put data from a sequence object into an image.
putpalette(self, data, rawmode='RGB')
Put palette data into an image.
putpixel(self, xy, value)
Set pixel value
设置某坐标像素点值
quantize(self, colors=256, method=0, kmeans=0, palette=None)
resize(self, size, resample=0)
Resize image
重新设置图像大小
rotate(self, angle, resample=0, expand=0)
Rotate image. Angle given as degrees counter-clockwise.
旋转图像
save(self, fp, format=None, **params)
Save image to file or stream
保存图像
seek(self, frame)
Seek to given frame in sequence file
定位到动画某一帧,一般用于gif格式的文件图片
show(self, title=None, command=None)
Display image (for debug purposes only)
现实图像,调用默认的图像浏览器
split(self)
Split image into bands
将图像按照RGB分别解析,返回三个Image对象
tell(self)
Return current frame number
返回当前帧号
thumbnail(self, size, resample=0)
Create thumbnail representation (modifies image in place)
创建缩略图,主要用来修改图像大小和清晰度,以便生产较小的文件
tobitmap(self, name='image')
Return image as an XBM bitmap
tostring(self, encoder_name='raw', *args)
Return image as a binary string
transform(self, size, method, data=None, resample=0, fill=1)
Transform image
transpose(self, method)
Transpose image (flip or rotate in 90 degree steps)
verify(self)
Verify file contents.
--------------------------------------------------------------------------------
Data and other attributes defined here:
format = None
mode
format_description = None
#功能:
blend(im1, im2, alpha)
Interpolate between images.
将两张图片混合到一起。参数alpha是im1与im2的混合权重,范围为[0,1]
Python PIL库之Image注解(API)的更多相关文章
- Python PIL 库的应用
PIL (Python Image Library) 库是Python 语言的一个第三方库,PIL库支持图像存储.显示和处理,能够处理几乎所有格式的图片. 一.PIL库简介 1. PIL库主要有2个方 ...
- python PIL 库处理文件
通过PIL库提供的API接口可以很方便的处理图像,功能十分强大: 最近有一个替换png背景色的需求,替换背景色的同时又不能够覆盖原来的文字,之前利用perl 的CD 模块一直没能够正确处理,最终用PI ...
- Python PIL库学习笔记
1.PIL简介 Python Imaging Library(缩写为PIL)(在新的版本中被称为Pillow)是Python编程语言的开源库,它增加了对打开,操作和保存许多不同图像文件格式的支持.它适 ...
- 使用Python PIL库中的Image.thumbnail函数裁剪图片
今天,是我来到博客园的第五天,发现自己还没有头像,想着上传ubuntu系统中我很喜欢的一个背景图片来当头像,但是因为图片过大,上传失败了.那么,我们如何使用python中强大的PIL库来进行图片裁剪呢 ...
- python PIL库的使用
)PIL可以做很多和图像处理相关的事情: 图像归档(Image Archives).PIL非常适合于图像归档以及图像的批处理任务.你可以使用PIL创建缩略图,转换图像格式,打印图像等等. 图像展示(I ...
- 基于Python PIL实现简单图片格式转化器
基于Python PIL实现简单图片格式转化器 目录 基于Python PIL实现简单图片格式转化器 1.简介 2.前期资料准备 2.1.1如何实现图片格式转换? 2.1.2如何保存需要大小的图片? ...
- Python图像处理库(PIL)
官方:(详细)http://pillow.readthedocs.io/en/3.1.x/reference/ImageDraw.html http://pillow.readthedocs.io/e ...
- ❤️【Python从入门到精通】(二十六)用Python的PIL库(Pillow)处理图像真的得心应手❤️
您好,我是码农飞哥,感谢您阅读本文,欢迎一键三连哦. 本篇重点介绍Python处理图像的标准库PIL库,处理图像真的的很方便. 干货满满,建议收藏,需要用到时常看看. 小伙伴们如有问题及需要,欢迎踊跃 ...
- Python 之 使用 PIL 库做图像处理
http://www.cnblogs.com/way_testlife/archive/2011/04/17/2019013.html Python 之 使用 PIL 库做图像处理 1. 简介. 图像 ...
随机推荐
- 昨天冲动的搬到外面住了,oh yeah
昨天我纠结了一天,我是否应该搬到外面去住.我骑着我的自行车,在外面闲逛,我心里想的是,我现在没有钱,可以节约一些生活费,租房的日子,我以后始终都是需要面对的,在目前没有那么多钱的情况下,可以不出去外面 ...
- ExtJs owner.componentLayoutCounter问题解
owner.componentLayoutCounter问题解:listeners : { render : function(grid) ...
- 牛客_剑指offer_重建二叉树,再后续遍历_递归思想_分两端
总结: 重建二叉树:其实就是根据前序和中序重建得到二叉树,得到后续,只要输出那边设置输出顺序即可 [编程题]重建二叉树 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的 ...
- 输出一个等边三角形的字母阵,等边三角形的两腰为字母A,往里靠依次字母大一个(详细题目文章中描述)
题目简单的描述就是输出这么一个金字塔型的字母阵(等边三角形) /* A ABA ABCBA */ /* //解法①:对称轴法 #import <stdio.h> int main() { ...
- C语言文件读写
1.用fopen打开文件 该函数的原型为FILE *fopen(const char *filename, const char *mode),第一个参数是文件名,第二个参数是打开文件的模式. 打开文 ...
- [转]JavaScript去重的6种方法
Array.prototype.unique1 = function() { var n = []; for(var i = 0; i < this.length; i++) { if (n.i ...
- php嵌入html的解析过程
php嵌入html的解析过程 示例: 执行过程: 首先明确:PHP是分段读取一次执行(编译),JS是分段读取分段执行 程序就是对内存的操作 函数可以先调用后定义,原因,程序的执行时 ...
- 把十进制整数转换为r(r=2)进制输出(顺序栈实现)
上周的第二个作业补上~~ 上周的要求: 1.给出顺序栈的存储结构定义. 2.完成顺序栈的基本操作函数. 1) 初始化顺序栈 2) 实现入栈和出栈操作 3) 实现取栈顶元素 ...
- C++ GUI Programming with Qt4 笔记 -- chap2 QDialog
以 finddialog 为例,介绍 QDialog.并对 Qt 的基本概念和技巧做了更进一步(chap1)的介绍. 1.MOC 扩展与signals–slots 机制 严格来说,Qt 开发,写的并不 ...
- OpenJudge / Poj 2141 Message Decowding
1.链接地址: http://poj.org/problem?id=2141 http://bailian.openjudge.cn/practice/2141/ 2.题目: Message Deco ...