On Fri, Jan 7, 2011 at 22:04, Narendra Sisodiya
<naren...@narendrasisodiya.com> wrote:
> Can somebody give an easy way to convert a image into black and white using
> a given threshold..
>
> Currently I am doing like this
>
>    image=ImageOps.grayscale(image)
>    for i in range(0,width):
>        for j in range(0,height):
>            if image.getpixel((i,j)) <= 200:
>                image.putpixel((i,j),0)
>
What's the problem with your code?  What you're doing is called image
binarization, afaik.  Thresholding is the basic way to do it, are you
unhappy with the results, or the speed of execution?  If it is speed,
the docs at http://www.pythonware.com/library/pil/handbook/image.htm
say you should consider using `getdata' ...

> What is the general mailing list to ask question on python ?
>
This is one.
There is also: http://mail.python.org/mailman/listinfo/baypiggies
And http://mail.python.org/mailman/listinfo/python-list


-- 
http://about.me/rosh
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to