[Image-SIG] 3-bit color palette
Fredrik Lundh
fredrik at pythonware.com
Sun Mar 30 14:41:39 CEST 2008
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>
More information about the Image-SIG
mailing list