I would like to know how to change more than one pixel value in a mode P
image with PIL
.
In my case I have 3 pixels values: 0, 1 , 2. I would map them respectively to 255, 76, 124.
I tried:
Image.open(my_image).point(lambda p: 255 if p==0 else (76 if p==1 else 124))
When I run the code above, I get an image with all black pixels.
Why?
Sholud I use a different function rather than point()
?
Update:
.getpalette()
returns {0, 255}