[Image-SIG] 3-bit color palette
Gokce Taskan
gokcetaskan at gmail.com
Mon Mar 31 00:11:40 CEST 2008
>> 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
>
> ...
>
Thank you Fredrik, it worked great.
More information about the Image-SIG
mailing list