putpixel

from PIL import Image

img = Image.open("D:\Python27\ggg.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')

posted on 2016-11-30 20:15  chinxfin  阅读(296)  评论(0编辑  收藏  举报

导航