9951 explained code solutions for 126 technologies


python-pillowHow to invert image


from PIL import Image, ImageOps

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

im.show()ctrl + c
PIL

import Pillow package modules

Image.open

open given image with Pillow

ImageOps.invert(

inverts image colors

.show()

displays resulting image