from PIL import Image
import cv2 as cv
import numpy as np
image = Image.open('xxx.jpg')
image_cv = cv.cvtColor(np.asarray(image), cv.COLOR_RGB2BGR)
'''
经过opencv处理后,转为PIL格式并保存
'''
image_pil = Image.fromarray(cv.cvtColor(image_cv , cv.COLOR_BGR2RGB))
image_pil.save('xx.jpg')