Python pillow Image图像处理

PIL ,Python Image Librara  图像处理的第三方库

pip install pillow安装库


#图片变灰透明

from PIL import Image

import numpy as np

a = np.array(Image.open("xxx/3.jpg").convert('L'))  #变灰

b = 255 - a                                                              #取灰度值    通过写改这一行可以变换图片灰度

im = Image.fromarray(b.astype('uint8'))               #数组转换为图片

im.save("xxx/5.jpg")


#图像手绘效果(不上源码了 自己敲  气不气0.O)

Python pillow Image图像处理

效果如下:(欧文大佬。。。。有点面目全非  嘿嘿。。)

Python pillow Image图像处理