Gokce Taskan wrote:

> I am trying find a method to output a resonable image which would look 
> like the one in
> http://en.wikipedia.org/wiki/List_of_monochrome_and_RGB_palettes#3-bit_RGB

Map each layer to 0 if it's below 128, and 255 otherwise.

     from PIL import Image

     im = Image.open("sample.jpg")

     out = im.point(lambda x: x >= 128 and 255)
     out = out.convert("P") # optional

     ...

</F>

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to