1.安装OpenCV
pip install opencv-python
import cv2
# 读入图像
img = cv2.imread(r"image\lenacolor.png")
# 显示图像
cv2.imshow("demo", img)
cv2.waitKey(0)
cv2.destroyAllWindows()
# 保存图像
cv2.imwrite("save.png", img)
转载来源 https://www.cnblogs.com/REN-Murphy/p/15232975.html