python bmp转换为jpg 并删除原图的方法
如下所示:
#coding:utf-8
importos
fromPILimportImage
#bmp转换为jpg
defbmpToJpg(file_path):
forfileNameinos.listdir(file_path):
#print(fileName)
newFileName=fileName[0:fileName.find("_")]+".jpg"
print(newFileName)
im=Image.open(file_path+"\\"+fileName)
im.save(file_path+"\\"+newFileName)
#删除原来的位图
defdeleteImages(file_path,imageFormat):
command="del"+file_path+"\\*."+imageFormat
os.system(command)
defmain():
file_path="D:\\VideoPhotos"
bmpToJpg(file_path)
deleteImages(file_path,"bmp")
if__name__=='__main__':
main()
以上这篇pythonbmp转换为jpg并删除原图的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。
热门推荐
1 如何训练狗狗不叫
2 训练狗狗不叫
3 训练狗狗随行
4 怎么训练狗狗不叫
7 训练比熊狗狗教程
10 上海狗狗训练
11 怎么训练狗狗上厕所
12 训练狗狗趴下
13 狗狗服从训练
14 训练狗狗拒食
15 训练狗狗笑
16 训练狗狗大便
17 训练狗狗立
18 训练狗狗捡东西