调整图像色彩
1 from PIL import Image,ImageEnhance 2 img = Image.open(r'C:\Users\87823\Desktop\tree.png') 3 w,h = img.size 4 img_output = Image.new('RGB',(3*w,h)) 5 #将原图复制到(0,0) 6 img_output.paste(img,(0,0)) 7 #获取色彩调整器 8 img_color = ImageEnhance.Color(img) 9 # 增强色彩 10 imgb = img_color.enhance(1.5) 11 img_output.paste(imgb,(w,0)) 12 # 减弱色彩 13 imgb = img_color.enhance(0.5) 14 img_output.paste(imgb,(2*w,0)) 15 img_output.show()
正是江南好风景