现在的位置: 首页 > 综合 > 正文

Python PIL库之Image注解(API)

2013年12月01日 ⁄ 综合 ⁄ 共 2577字 ⁄ 字号 评论关闭
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]

  

抱歉!评论已关闭.