我是靠谱客的博主 殷勤小蚂蚁,最近开发中收集的这篇文章主要介绍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库之Image注解(API)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(44)

评论列表共有 0 条评论

立即
投稿
返回
顶部