#coding:utf-8 # import os from PIL import ImageGrab from PIL import Image path = "d:\\mobile\\pingmu.png" im = ImageGrab.grab() img = im.convert("RGBA") pixdata = img.load() #二值化 for y in xrange(img.size[1]): for x in xrange(img.size[0]): #print pixdata[x, y] #print pixdata[x, y][0] if(pixdata[x, y]==(223,75,80,255)): print x print y img.save(path)