putpixel

from PIL import Image

img = Image.open("D:Python27ggg.gif")
(w,h) = img.size
im=img.convert("RGBA")

for i in xrange(w):
for j in xrange(h):
pos=(i,j)
rgb = im.getpixel(pos)

if rgb == (255,255,255,255):
im.putpixel((i,j),(0,0,0,0))

im.save('D:\Python27\ggg888.gif')



#(r,g,b) = rgb

'''
if(b > g and b > r):
b=213
g=192
r=180
img.putpixel((i,j), (000,000,000))

'''
#im.show()

#p.save('D:\Python27\mask6.gif')
原文地址:https://www.cnblogs.com/cutepython/p/6119502.html