import os
from PIL import Image
# bmp 转换为jpg
def bmpToJpg(file_path):
for fileName in os.listdir(file_path):
# print(fileName)
newFileName = fileName[0:fileName.find(".")] + ".jpg"
print(newFileName)
im = Image.open(file_path + "\\" + fileName)
im.save(file_path + "\\" + newFileName)
# 删除原来的位图
def deleteImages(file_path, imageFormat):
command = "del " + file_path + "\\*." + imageFormat
os.system(command)
def main():
file_path = "E:\\受电弓数据\\2019_09_19-20_24_19[3.3.0.1]{No1136}{5660204C-2CDC-4E55-B810-3B411B9EB3D9}(A-11009)B(1)\\2019_09_19-20_24_19[3.3.0.1]{No1136}{5660204C-2CDC-4E55-B810-3B411B9EB3D9}(A-11009)B\\bmp"
bmpToJpg(file_path)
# deleteImages(file_path, "bmp")
if __name__ == '__main__':
main()