import cv2
pip install cv2
img = cv2.imread(file, 0)
img = cv2.resize(img, (img_width, img_height))
img =cv2.flip(img,1)
img = cv2.transpose(img)
img =cv2.flip(img,1)
img = cv2.transpose(img)
img =cv2.flip(img,0)
img = (255 - img) / 256