1 # -*- coding: utf-8 -*- 2 """ 3 Created on Sun Apr 12 22:03:26 2020 4 5 @author: 49594 6 """ 7 8 from PIL import Image 9 from PIL import ImageEnhance 10 from PIL import ImageFilter 11 im = Image.open("D:\python\img\aixin.jpg")#读图片 12 im.thumbnail((128,128)) 13 im=im.convert('RGB') 14 im.save("a_small.jpg","JPEG") 15 r,g,b = im.split() 16 om =Image.merge("RGB",(b,g,r)) 17 om.save("b_changecolor.jpg","JPEG") 18 pm= im.filter(ImageFilter.CONTOUR) 19 pm.save("c_contour.jpg","JPEG") 20 qm = ImageEnhance.Contrast(im) 21 qm.enhance(20).save("d_EnContrast.jpg","JPEG")