目录
1.常用引入方式
>>> from PIL import Image
2.处理图片时的常用属性
PIL.Image.format
PIL.Image.mode
PIL.Image.palette
PIL.Image.size
3.剪切、合并图像函数
Image.cpoy()
Image.crop (box)
Image.paste (im, box , mask)
Image.merge ("RGB", (b, g, r)
4.读取、创建图像函数
Image.open('ilename jpg')
Image.new(mode, size,color)
Image.open (StringIo.StringIO(buffer))
TarIO.TarIO("Im.tar","Im.ppm")
Image.fromarray(obj, mode)
Image.frombytes(mode, size, data)
Image.frombuffer (mode, size, data)
Image. verify()
5.图形绘制函数
ImageDraw. Draw.line (ixy, fill, width)
ImageDraw. Draw.arc(xy, start, end,fil1)
ImageDraw. Draw.chord(xy, start, end,fill, outline)
ImageDraw. Draw.bitmap (xy,bitmap, fi1l)
ImageDraw. Draw.ellipse(xy,fill, outline)
ImageDraw. Draw.point (xy,fil1)
ImageDraw. Draw.polygon (xy,fill, outline)
ImageDraw. Draw.rectangle(xy,fill, outline)
ImageDraw. Draw.text (xy,text, fill, font, anchor)
ImageDraw. Draw.textsize(text, font)
6.获取数据函数
Image.getdata ()
Image.getbands ()
Image. getpixel(xy)
Image.getcolors(max=256)
Image.getextrema()
Image.getbox ()
Image.histogram (mask)
7.序列操作函数
Image.seek (frame)
Image.tell()
8.转换,保存图像函数
Image.save( (title, command)')
Image.show (title, command)
Image. convert (mode, matrix, colors=256)
Image.thumbnail (size, resample=1)
Image. draft ()
9.像素点,通道处理函数
Image.point (lut, mode=None)
Image.eval (im,*args) Image. load()
Image.split()
Image.merge ()
Image.blend (im1,im2, alpha)
Image.composite(im1,im2, mask)
Image.alpha composite(im1,im2)
10.增强、滤镜函数
Image.filter (ImageFilter.fuction)
ImageEnhance.enhance (Factor)
ImageEnhance.color(im)
ImageEnhance.Contrast (im)
ImageEnhance.Brightness (im)
ImageEnhance.Sharpness (im)
11.几何变换函数
Image.resize(size)
Image.rotate(angle,resample=0,expand=0)
Image.transpose(method)
Image.transform(size,method, data, resample, fill)