当前位置: 移动技术网 > IT编程>脚本编程>Python > python bmp转换为jpg 并删除原图的方法

python bmp转换为jpg 并删除原图的方法

2018年11月05日  | 移动技术网IT编程  | 我要评论

巨乳女子校生,八通杂谈,兔女郎瑞雯的酒吧日记

如下所示:

# coding:utf-8
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 = "d:\\videophotos"
 bmptojpg(file_path)
 deleteimages(file_path, "bmp")


if __name__ == '__main__':
 main()

以上这篇python bmp转换为jpg 并删除原图的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网