Created
May 14, 2021 06:18
-
-
Save Sucareto/266c46a6c9757afd46ed0fe92e67bb7f to your computer and use it in GitHub Desktop.
从svo文件导出dds图像。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
for i in os.listdir('source'): | |
with open('source/' + i, 'rb') as f: | |
print(i + " : ") | |
data = f.read() | |
index = data[0:].find(b'DDS') | |
os.mkdir(i[:-4]) | |
while True: | |
endindex = data[index+1:].find(b'DDS') | |
if endindex == -1: | |
dds = data[index:] | |
else: | |
dds = data[index: index + endindex + 1] | |
print(str(index) + ' to ' + str(endindex)) | |
with open(i[:-4] + '/' + str(index)+'.dds', 'wb') as d: | |
d.write(dds) | |
if endindex == -1: | |
break | |
index += endindex + 1 | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment