#-*- coding:utf-8 -*-
import os.path
import fnmatch
import shutil
def open_save(file,savepath):
# 读入一个seq文件,然后拆分成image存入savepath当中
f = open(file,'rb')
#将seq文件的内容转化成str类型
string = str(f.read())
#splitstring是图片的前缀,可以理解成seq是以splitstring为分隔的多个jpg合成的文件
splitstring = "\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46"
#split函数做一个测试,因此返回结果的第一个是在seq文件中是空,因此后面省略掉第一个
"""
>>> a = ".12121.3223.4343"
>>> a.split('.')
['', '12121', '3223', '4343']
"""
strlist=string.split(splitstring)
#print(strlist)
#print('######################################')
f.close()
count = 0
# delete the image folder path if it exists
if os.path.exists(savepath):
shutil.rmtree(savepath)
# create the image folder p
将seq文件转换成JPEG文件
最新推荐文章于 2022-12-15 16:23:28 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)