Make a filter to one color
<p>I tried to make a function to detect some word from browser. My current solution is take the screenshot in location where the text can appear.</p>

<pre><code> im = ImageGrab.grab(bbox=(1229, 11, 1233, 20))
     im = im.convert('1')
     pixels = im.getdata()
</code></pre>

<p>But, it work with only small picture what capture by <code>grab</code> function. And, the text i want to detect have an unique color. So, have anyway to make a filter can make all diffrent colors disappear and show only white and that text?</p>

<p>You can use filtering on each point of image using the code below:</p>

<pre><code>output = pixels.point(lambda x: 1 if x==REQUIREDCOLOR else 0, '1')
</code></pre>

python python-imaging-library