PIL基本处理命令

from PIL import Image
pil_im = Image.open('empire.jpg')    #打开图片
pil_im = Image.open('empire.jpg').convert('L')  #转换位灰色图像
pil_im.thumbnail((128,128))  ·        #缩略图
box = (100,100,400,400)             #复制和粘贴
region = pil_im.crop(box)
out = pil_im.resize((128,128))          #重新设定大小
out = pil_im.rotate(45)              #逆时针旋转45度

posted @ 2017-11-12 23:59  黄冠积  阅读(419)  评论(0编辑  收藏  举报