import cv2
import glob
import numpy as np
from PIL import Image
imagelist = glob.glob('*.jpg')
for imagename in imagelist:
image = Image.open(imagename)
image = np.asarray(image)
rotated = np.rot90(image, 3)
r, g, b = rotated[:, :, 0], rotated[:, :, 1], rotated[:, :, 2]
h, w = r.shape
new = np.zeros((h, w, 3))
new[:, :, 0] = b
new[:, :, 1] = g
new[:, :, 2] = r
cv2.imwrite(imagename, new)



