#!/usr/bin/env python # encoding: utf-8 import numpy as np from PIL import Image class picture: def __init__(self): self.path = 'assets/picture.jpeg' def hello(self): return self def run(self): im = self.reverse() im.show() im.save('assets/reverse.jpeg') def reverse(self): im = 255 - np.asarray(Image.open(self.path).convert('RGB')) return Image.fromarray(np.array(im).astype('uint8')) if __name__ == '__main__': picture().hello().run()