你必须先阅读图像cv2.imread()然后 cv2.imwrite() 这是一个小例子importcv2 # read image as grey scalegrey_img=cv2.imread('/home/img/python.png',cv2.IMREAD_GRAYSCALE) # save imagestatus=cv2.imwrite('/home/img/python_grey.png',grey_img) print("Image written to file-system : ",status)如果您没有文件夹路径,那么使用它 status=cv2.imwrite('python_grey.png',grey_img) 会将照片保存在您保存.py文件的默认文件夹中如果你想在这里保存不同的图像是代码import cv2import time# for number of images you need different names so set name automaticallyname=str(time.time())+str(.png)) # read image as grey scalegrey_img=cv2.imread('/home/img/python.png',cv2.IMREAD_GRAYSCALE) # save imagestatus=cv2.imwrite('%s'%name,grey_img) print("Image written to file-system : ",status)