Skip to content

Instantly share code, notes, and snippets.

@Sucareto
Created May 14, 2021 06:18
Show Gist options
  • Save Sucareto/266c46a6c9757afd46ed0fe92e67bb7f to your computer and use it in GitHub Desktop.
Save Sucareto/266c46a6c9757afd46ed0fe92e67bb7f to your computer and use it in GitHub Desktop.
从svo文件导出dds图像。
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