9951 explained code solutions for 126 technologies

python-pillowHow to map image using point() method

from PIL import Image, ImageOps

im = Image.open('/var/www/examples/heroine.png')

im = im.point(lambda p: p > 100 and 255)
im.show()ctrl + c

import Pillow package modules


open given image with Pillow


maps an image with a given callback

p > 100 and 255

trims colors beyond value of 100 and returns 255


displays resulting image