In [1]:
from PIL import Image, ImageOps
In [2]:
im = Image.open('data/src/lena.jpg')
im_invert = ImageOps.invert(im)
im_invert.save('data/dst/lena_invert.jpg', quality=95)
In [3]:
im = Image.open('data/src/horse.png').convert('RGB')
im_invert = ImageOps.invert(im)
im_invert.save('data/dst/horse_invert.png')