import PIL
import numpy as np
img = PIL.Image.open("myimage.png") # The image is load in RGB order.
img = np.asarray(img)'''The Image.open() method opens a file in binary
format which needs to be converted to numpy however the order is still
RGB. Below is the conversion to BGR is done:'''
screen = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
# It is also possible to go in reverse:
screen = cv2.cvtColor(screen, cv2.COLOR_BGR2RGB)