import os
import cv2
import sys
import numpy as np
path = "F:\\ImageLib\\VRWorks_360_Video _SDK_1.1\\footage14\\"
print(path)
for filename in os.listdir(path):
if os.path.splitext(filename)[1] == '.png':
# print(filename)
img = cv2.imread(path + filename)
print(filename.replace(".png",".jpg"))
newfilename = filename.replace(".png",".jpg")
# cv2.imshow("Image",img)
# cv2.waitKey(0)
cv2.imwrite(path + newfilename,img)
读取png图像,转成jpg图像存储。