1.转换成灰度图片
from PIL import Image
Image.open('in.jpg').convert('L').save('out.jpg');
一行代码搞定,是不是很酷~
2.图形复制与粘贴
from PIL import Image
import os
pil_im = Image.open('in.png');
box = (0,162,30,192)
box2 = (200,162,230,192)
region = pil_im.crop(box)
pil_im.paste(region,box2)
pil_im.save('out.png')