PIL添加一个像素序列到图像

from PIL import Image

img = Image.open(“图片路径”)
img = img.convert(“L”) #灰度化
img.show()

imgdata = list(img.getdata())
print(imgdata)

addlist = []
for i in range(len(imgdata)):
if imgdata[i]>250:
addlist.append(imgdata[i]-100)
else:
addlist.append(imgdata[i])

img.putdata(addlist)
img.show()


date: 2018-09-25 22:44:22

tags: python

-------------���Ľ�����л�����Ķ�-------------
青花猪的忧伤 wechat
ex. subscribe to my blog by scanning my public wechat account
坚持原创技术分享,您的支持将鼓励我继续创作!
undefined