Python 图像处理介绍
缩放图片
from PIL import Image
img=Image.open('hello.jpg')
print(img.size)
width,height=img.size
img.thumbnail((width/10,height/10))
img.save('hello1.png','png')
[原图片hello.jpg]

[缩放图片hello1.png]

图片的模糊效果
from PIL import Image,ImageFilter
img=Image.open('hello.jpg')
img1=img.filter(ImageFilter.BLUR)
img2=img.filter(ImageFilter.CONTOUR)
img3=img.filter(ImageFilter.DETAIL)
img4=img.filter(ImageFilter.EDGE_ENHANCE)
img1.save('hello1.png','png')
img2.save('hello3.png','png')
img3.save('hello4.png','png')
img4.save('hello5.png','png')
[原图片hello.jpg]

[模糊后的图片hello2.png]

[轮廓图像hello3.png]

[细节增强后图像hello4.png]

[边缘增强后图像hello5.png]